Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么WA???大佬们求解释啊

Posted by sdufe20151845113 at 2017-04-13 20:31:48 on Problem 3624
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator