You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
467 B

#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int M = 110;
int n;
int m1, m2;
int f[M][M];
int main() {
cin >> n >> m1 >> m2;
for (int i = 1; i <= n; i++) {
int v1, v2, w;
cin >> v1 >> v2 >> w;
for (int j = m1; j >= v1; j--)
for (int k = m2; k >= v2; k--)
f[j][k] = max(f[j - v1][k - v2] + w, f[j][k]);
}
printf("%d\n", f[m1][m2]);
return 0;
}