这个问题是01背包,而对于编程之美那道是完全背包问题,在编程之美中也有一个0,1背包问题。
而且是容量是小于等于,不是等于,对于是否等于,在初始化参数时候不一样,不小于全部初始化为0,恰好等于,初始化为无穷大,除了0.问什么呢?看算法入门竞赛那本,
背包问题其实不是很好理解,但是代码最终形式很简单,...
分类:
其他好文 时间:
2014-05-11 06:48:30
阅读次数:
246
Ignatius and the Princess III
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 11896 Accepted Submission(s): 8424
Problem Descript...
分类:
其他好文 时间:
2014-05-07 11:58:46
阅读次数:
403
题意:给定背包体积与物品的体积与价值 求正好放完的最小价值#includeusing
namespace std;int min(int a,int b){ if(a>t; while(t--) {
cin>>m1>>m2; m=m2-m1; ...
分类:
其他好文 时间:
2014-05-03 22:37:20
阅读次数:
437
本文出自:http://blog.csdn.net/svitter
原题:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1053
题意:完全背包不解释。。直接贴代码。。
#include
#include
#include
using namespace std;
#defi...
分类:
其他好文 时间:
2014-05-03 16:06:14
阅读次数:
324
Pick apples
Time Limit: 1000MS Memory limit: 165536K
题目描述
Once ago, there is a mystery yard which only produces three kinds of apples. The number of each kind is infinite. A girl carrying a...
分类:
移动开发 时间:
2014-04-29 13:18:22
阅读次数:
489