Descriptionwindy学会了一种游戏。对于1到N这N个数字,都有唯一 且不同的1到N的数字与之对应。最开始windy把数字按顺序1,2,3,……,N写一排在纸上。然后再在这一排下面写上它们对应的数字。然后又在新的一 排下面写上它们对应的数字。如此反复,直到序列再次变为1,2,3,……,N。...
分类:
其他好文 时间:
2015-03-28 14:14:22
阅读次数:
178
题意:给出T个数字,编号1~T,每个数字有N[i]个。用这些数字组成一个序列,最后问长度在S~B之间的不同序列有多少种。
思路:分组背包。每个蚂蚁家族为一个分组,在每个分组里的选择有N[i]种(选1~N[i])。背包九讲...
分类:
其他好文 时间:
2015-03-19 22:06:47
阅读次数:
149
#include int w[301][21]; int get_max(int a, int b){ if(a>=b) return a; else return b;}int main(void){ int tc, T; ...
分类:
其他好文 时间:
2015-03-13 18:33:46
阅读次数:
244
依旧是状态分组——求K个机器人从同一点出发,遍历所有点所需的最小花费Sample Input3 1 11 2 11 3 13 1 21 2 11 3 1Sample Output32 1 /* 2 HDU 4003 3 树形DP+只能选一个物品的分组背包 4 5 dp[pos][num]表示以po....
分类:
其他好文 时间:
2015-03-11 10:41:47
阅读次数:
173
卡在为什么是分组背包的问题上,看了下面几句话理解了题意就是给定n个点,每个地点有value[i]的宝物,而且有的宝物必须是另一个宝物取了才能取,问取m个点可以获得的最多宝物价值。一个子节点就可以返回m个状态,每个状态表示容量为j(j 8 #include 9 #include10 #include1...
分类:
其他好文 时间:
2015-03-10 11:37:12
阅读次数:
137
背景:1Y,01背包多加了一个挑选循环而已。
分组背包的典型描述:对于很多背包,把它分为k个组,每个组内的组员是相互冲突的,所以只能选择一个。
我的代码:
#include
#include
#include
using namespace std;
int main(void){
int n,m;
while(scanf("%d%d",&n,&m),n*n+m*m){
...
分类:
其他好文 时间:
2015-03-08 23:06:28
阅读次数:
184
I love sneakers!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4253 Accepted Submission(s): 1735
Problem Description
After mon...
分类:
其他好文 时间:
2015-03-08 14:19:02
阅读次数:
142
http://acm.hdu.edu.cn/showproblem.php?pid=4044
Problem Description
Tower defense is a kind of real-time strategy computer games. The goal of tower defense games is to try to stop enemies f...
分类:
其他好文 时间:
2015-02-11 14:39:31
阅读次数:
155
1 /* 2 有n件物品和一个容量为v的背包,第i件物品的费用是c[i],价值是w[i] 3 这些物品被分为若干组,每组中的物品互相冲突,即一组中只能取一件物品 4 将哪些物品装入背包使得总价值最大 5 dp[k][v] 表示前k组物品花费容量v能取到的最大值 6 dp[k][v] = max(d....
分类:
其他好文 时间:
2015-02-08 10:18:03
阅读次数:
469
http://acm.hdu.edu.cn/showproblem.php?pid=4341
Problem Description
Homelesser likes playing Gold miners in class. He has to pay much attention to the teacher to avoid being noticed. So he...
分类:
其他好文 时间:
2015-02-05 11:22:52
阅读次数:
163