题目:2. 01背包问题
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+10;
int n,v;
int f[1010];
int main(){
cin>>n>>v;
int x,y;
for(int i=0;i<n;i++){
cin>>x>>y;
for(int j=v;j>=x;j--)
f[j]=max(f[j],f[j-x]+y);
}
cout<<f[v];
return 0;
}