qwertyuiop

02321736m  •  14小时前


include <bits/stdc++.h>

using namespace std; int w[1001], v[1001]; long long dp[1001];

int main() {

int n, c, sum = 0, ans = 0;
cin >> n >> c;
for (int x = 1; x <= n; x++) {
	int a, b;
	cin >> a >> b >> w[x];
	v[x] = b - a;
	sum += a;
}
for (int x = 1; x <= n; x++)
	for (int y = c; y >= w[x]; y--)
		dp[y] = max(dp[y], dp[y - w[x]] + v[x]);
ans = sum += dp[c];
ans *= 5;
cout << ans;
return 0;

}


评论:

请先登录,才能进行评论