#include<iostream>
using namespace std;
#define NEM 5//每个物品的重量
#define WI 10//背包总容量
int max(int a,int b){
return a>b?a:b;
}
int main(){
int w[NEM]={0};
cout<<"please put in the wight of every thing in order "<<endl;
for(int k=0;k<NEM+1;k++)
cin>>w[k];
cout<<"please put in the value of every thing in order "<<endl;
int v[WI]={0};
for(k=0;k<NEM+1;k++)
cin>>v[k];
int b[NEM+1][WI+1]={0};
for(int i=1;i<NEM+1;i++){
for(int j=1;j<WI+1;j++){
if(j>=w[i])
b[i][j]=max(b[i-1][j],b[i-1][j-w[i]]+v[i]);
}
}
cout<<b[NEM][WI]<<endl;
return 1;
}
#includeusing namespace std;#define NEM 5//每个物品的重量#define WI 10//背包总容量int max(int a,int b){ return a>b?a:b;}int main(){ int w[NEM]={0}; cout<<"please put in the wight of every