Description有n种不同大小的数字,每种各个。判断是否可以从这些数字之中选出若干使它们的和恰好为K。Input首先是一个正整数T(1 2 # include 3 # define LL long long 4 using namespace std ; 5 6 int n , k ; 7.....
分类:
其他好文 时间:
2015-05-25 18:02:45
阅读次数:
156
Divideing Jewels时间限制:1000ms | 内存限制:65535KB难度:4描述Mary and Rose own a collection of jewells. They want to split the collection among themselves so that ...
分类:
其他好文 时间:
2015-05-24 18:50:45
阅读次数:
144
题目大意:给树上n个点染k个黑色,求黑点之间、白点之间距离和的最大值。思路:感觉是树形dp,但是觉得转移的时候很难受。后来听到fye大神的背包,就开始想背包方向想,发现多重背包可以解决。我们dfs一个孩子之后就可以进行背包了。但是赋初值的时候,要给f[u][0]和f[u][1]都赋为0,因为对于u这...
分类:
其他好文 时间:
2015-05-22 08:12:44
阅读次数:
117
DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the ...
分类:
其他好文 时间:
2015-05-20 17:56:07
阅读次数:
120
提供多重背包的一些思路DescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College ha...
分类:
其他好文 时间:
2015-05-18 22:52:57
阅读次数:
119
多重背包。
每个物品分别dp。。
dp[i][j]表示考虑了前i个物品。。装满j的背包。。第i个物品最少拿多少个
这样就可以了
转移大概是。。。dp[i][j] = std::min(dp[i][j - a[i]] + 1, 0 if dp[i
- 1][j]
a[i]是第i个物品的大小
c[i]是数量
Coins
Time Limit: 2000/1...
分类:
其他好文 时间:
2015-05-15 19:58:09
阅读次数:
136
简单写下自己的理解吧……Pack 三种物品的背包: 1. $v(x)=A*x^2-B*x$ 价值随所分配的体积的变化而变化…… 2. 多重背包 3. 完全背包 其实是个傻逼题,因为数据规模小,暴力就能过,然而由于没见过第一种物品的价值函数,加上题目描述不清楚,所以自己傻逼了...
分类:
其他好文 时间:
2015-05-14 16:15:23
阅读次数:
214
题目的意思是,输入n个硬币的面值和数量,求不超过m的组合方法的数目。
今天学习了多重背包,但是还是不是很懂,继续努力。
下面的是AC的代码:
#include
#include
#include
#include
using namespace std;
class data
{
public:
int value, count;
};
data Da[101];
int d...
分类:
其他好文 时间:
2015-05-14 08:43:32
阅读次数:
125
题意:FJ身上有各种硬币,但是要买m元的东西,想用最少的硬币个数去买,且找回的硬币数量也是最少(老板会按照最少的量自动找钱),即掏出的硬币和收到的硬币个数最少。思路:老板会自动找钱,且按最少的找,硬币数量也不限,那么可以用完全背包得出组成每个数目的硬币最少数量。而FJ带的钱是有限的,那么必须用多重背...
分类:
其他好文 时间:
2015-05-11 12:28:17
阅读次数:
243
题意:给出价值和数量,求能分开的最近的两个总价值,例如10,20*2,30,分开就是40,40链接:点我 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace st...
分类:
其他好文 时间:
2015-05-10 12:36:26
阅读次数:
113