#include<bits/stdc++.h> using namespace std; const int N=1e3+10; int n,m1,m2; int v1[N],v2[N],w[N]; int f[N][N]; int main() { cin>>n>>m1>>m2; for(int i=1;i<=n;i++) cin>>v1[i]>>v2[i]>>w[i]; for(int i=1;i<=n;i++) for(int j=m1;j>=v1[i];j--) for(int k=m2;k>=v2[i];k--) f[j][k]=max(f[j][k],f[j-v1[i]][k-v2[i]]+w[i]); cout<<f[m1][m2]; return 0; }
标签:费用,背包,int,v2,v1,二维,m1,m2,-- From: https://www.cnblogs.com/tolter/p/17113375.html