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 |
几乎一样诶 握爪 不过我是到这题水过40道……In Reply To:1A,纪念100题。 Posted by:1001030088 at 2011-10-08 14:01:55 #include<stdio.h> int bag[13000]={0}; int main(){ int n,m,M,V,t; scanf("%d%d",&n,&m); while(n--){ scanf("%d%d",&M,&V); for(int i=m;i>=M;i--){ t=V+bag[i-M]; if(t>bag[i])bag[i]=t; } } printf("%d\n",bag[m]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator