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

成功ac,也不知是福是祸,贴上代码,请求大神指教!!!

Posted by 20152430226 at 2017-03-26 20:25:10 on Problem 3624
#include <iostream>
#include <cstring>
#define Max 20000
using namespace std;
int main()
{
    int a[Max],i,j,w,v,M,N,temp;
    cin>>M>>N;
    for(i=1;i<= M;i++)
    {
        cin>>w>>v;
        for(j=N;j>=w;j--)
        {
            temp=a[j-w]+v;              
            if(temp>a[j])
                  a[j]=temp;
        }
    }
    cout<<a[N]<<endl;
}

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