随笔分类 -  动态规划

 
hdu2546 饭卡01背包
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=2546饭卡Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8220Accepted Submission(s): 2808Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以 阅读全文
posted @ 2013-12-16 20:24 那个人- 阅读(363) 评论(0) 推荐(0)
hdu 2955 0-1背包问题
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2955Problem 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 because they become too greedy. He has decided to work in the lucrative business of bank robbery only for 阅读全文
posted @ 2013-12-07 10:24 那个人- 阅读(212) 评论(0) 推荐(0)
hdu 1284 完全背包
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1284Problem Description在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。Input每行只有一个正整数N,N小于32768。Output对应每个输入,输出兑换方法数。Sample Input293412553Sample Output71883113137761#include #include #include using namespace std;int f[35000];int main(){ int n,i,j,k; ... 阅读全文
posted @ 2013-10-19 12:22 那个人- 阅读(261) 评论(0) 推荐(0)
hdu 0-1背包
摘要:题目地址http://acm.hdu.edu.cn/showproblem.php?pid=2602#include #include int main(){ int cost[1010],f[1010],va[1010]; int i,j,k,n,m; scanf("%d",&k); while(k--) { memset(f,0,sizeof(f)); scanf("%d%d",&n,&m); for(i=0;i=cost[i];j--) ... 阅读全文
posted @ 2013-10-14 18:45 那个人- 阅读(320) 评论(0) 推荐(0)