Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么WA???大佬们求解释啊#include <iostream> using namespace std; int main() { int n,m,w[401],d[101],i,j,k; int v[12881]={0}; cin>>n>>m; for(i=1;i<=n;i++) cin>>w[i]>>d[i]; for(i=1;i<=n;i++) { for(j=m;j>=w[i];j--) { if(v[j]<v[j-w[i]]+d[i]) v[j]=v[j-w[i]]+d[i]; } } cout<<v[m]<<endl; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator