| ||||||||||
| 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 | |||||||||
成功ac,也不知是福是祸,贴上代码,请求大神指教!!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator