intmain(){ cin >> n >> v >> m; for (int i = 0; i < n; i++) { int vi, mi, wi; cin >> vi >> mi >> wi; for (int j = v; j >= vi; j--) { for (int k = m; k >= mi; k--) { f[j][k] = max(f[j][k], f[j - vi][k - mi] + wi); } } } cout << f[v][m] << endl; return0; }
intmain(){ cin >> n >> m; for (int i = 0; i < n; i++) { int v, w, s; cin >> v >> w >> s; for (int j = m; j >= v; j--) { for (int k = 0; k <= s && j - k * v >= 0; k++) { f[j] = max(f[j], f[j - k * v] + k * w); } } } cout << f[m] << endl; return0; }