#include<cstdio>
#include<algorithm>
#define REP(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
const int MAXN = 11234;
int f[MAXN];
int main()
{
int n, m;
scanf("%d%d", &n, &m);
REP(i, 0, n)
{
int w, v;
scanf("%d%d", &w, &v);
for(int j = m; j >= w; j--)
f[j] = max(f[j], f[j - w] + v);
}
printf("%d\n", f[m]);
return 0;
}
51nod 01背包
猜你喜欢
转载自blog.csdn.net/qq_34416123/article/details/81807486
今日推荐
周排行