1 条题解
-
1HLBhahaqiu LV 8 MOD @ 2020-08-29 11:07:38
#include <iostream>
#include <cstdio>
using namespace std;
int f[9999]={0};
int n,m;
int a,b;
int main () {
cin>>n>>m;
for (int i=1; i<=n; i++) {
cin>>a>>b;
for (int j=m; j>=b; j--) {
f[j]=max(f[j],f[j-b]+a);
}
}
cout<<f[m];
return 0;
}
- 1