#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;	
} 

 

相关文章:

  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2022-02-22
  • 2021-11-16
相关资源
相似解决方案