#include<bits/stdc++.h>
using namespace std;
long long w[10005],c[10005],a[10005],dp[10005];
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>w[i]>>c[i]>>a[i];
	}
	for(int i=1;i<=n;i++){
		for(int j=c[i];j<=m;j++){
			if(a[i]--) dp[j]=max(dp[j],dp[j-c[i]]+w[i]);
		}
	}
	cout<<dp[m];
	return 0;
}

1 comments

  • 1

Information

ID
1118
Time
1000ms
Memory
256MiB
Difficulty
6
Tags
# Submissions
38
Accepted
13
Uploaded By