文章分类 -  背包

摘要:CoinsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5517Accepted Submission(s): 2280Problem DescriptionWhuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He dec 阅读全文
posted @ 2013-11-07 14:37 heaventouch 阅读(173) 评论(0) 推荐(0) 编辑
摘要:RobberiesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8527 Accepted Submission(s): 3224Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often bec... 阅读全文
posted @ 2013-10-13 08:30 heaventouch 阅读(104) 评论(0) 推荐(0) 编辑
摘要:Big Event in HDUTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19406 Accepted Submission(s): 6787Problem DescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer Colle.. 阅读全文
posted @ 2013-10-05 19:20 heaventouch 阅读(94) 评论(0) 推荐(0) 编辑
摘要:CoinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5407 Accepted Submission(s): 2230Problem DescriptionWhuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins... 阅读全文
posted @ 2013-09-23 09:13 heaventouch 阅读(118) 评论(0) 推荐(1) 编辑
摘要:最大报销额Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13691 Accepted Submission(s): 3804Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。 Inp... 阅读全文
posted @ 2013-09-16 22:43 heaventouch 阅读(92) 评论(0) 推荐(0) 编辑
摘要://01背包,直接模板题 #include#includeint dp[1005];int v[1005],c[1005];int max(int a,int b){ return a>b?a:b;}int main(void){ int t,n,m; scanf("%d",&t); while(t--) { memset(dp,0,sizeof(dp)); scanf("%d%d",&n,&m); for(int i=1;i=c[i];j--) dp[j]=max(dp[j],dp[j-c[... 阅读全文
posted @ 2013-09-12 12:00 heaventouch 阅读(69) 评论(0) 推荐(0) 编辑
摘要://01背包入门题,理解01背包的思想后直接可过//状态转移方程: dp[j]=Max(dp[j],dp[j-v[i]]+w[i]);#include<stdio.h>#define N 1005int dp[N*N]={0};int Max(int a,int b){ return a>b?a:b;}int main(void){ int t,n,m; int v[N],w[N]; scanf("%d",&t); while(t--) { for(int i=0;i<N*N;i++) dp[i]=0; scanf("%d%d&qu 阅读全文
posted @ 2013-06-01 09:06 heaventouch 阅读(93) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示