This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include<bits/stdc++.h>
usingnamespacestd;
constintN=110;
constintINF=0x3f3f3f3f;
intn,m;
intf[N];
intmain(){
cin>>n>>m;
memset(f,INF,sizeoff);
f[0]=0;
for(inti=1;i<=n;i++){
intv,w;
cin>>v>>w;
for(intj=m;j>=0;j--)
f[j]=min(f[j],f[max(0,j-v)]+w);//即使物品体积比j大,j - v < 0,也能选,等价于f[0]