![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Dp
文章平均质量分 66
Guyue_Oldman
这个作者很懒,什么都没留下…
展开
-
poj 1276 Cash machine
题目大意:给你N种货币,每种货币数量一定,和一个cash数,要求用这些货币选取若干组成的Cash数中小于或等于cash中的最大值 解题思路及算法:多重背包问题,数据巨大,简单的搜索及将多重背包转化成0/1背包(加上logn)肯定也超时!只能用O(n*cash)解决,最开始用n*cash*k也能水过!此题用完全背包的思想,要解决的就是每次加入的货币数不能超过n[i];(此处的处理方法:用一个数组来原创 2012-06-14 00:21:01 · 286 阅读 · 0 评论 -
poj 2063 Investment
题目大意:John总共有钱cash ,可以用于投资,一共有m种方案,每次投资后的本金和可再次用于投资,求多次投资后最大的本金和 解题算法:完全背包问题,注意题目细节问题,容易出错! #include #include const int max_size=100001; double dp[max_size],v[max_size]; int c[max_size/5]; int cases,原创 2012-06-14 02:04:11 · 315 阅读 · 0 评论 -
poj 3624 Charm Bracelet
最裸的0/1背包#include #include const int max_size=13881; int c[max_size],dp[max_size],v[max_size]; int num,weigh; void Dp() { int i,j; for(i=0;i<num;i++) for(j=weigh;j>=c[i];j--) if(dp[j-c[i]]+v[i]>原创 2012-06-14 00:47:32 · 281 阅读 · 0 评论