- 完全背包问题
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1010;
int f[maxn];
int v[maxn], w[maxn];
int main()
{int n, V;cin >> n >> V;for (int i = 1; i <= n; i++){cin >> v[i] >> w[i];}for (int i = 1; i <= n; i++){for (int j = v[i]; j<=V; j++){f[j] = max(f[j], f[j - v[i]] + w[i]);}}cout << f[V];return 0;
}