hdu1011 Starship Troopers】的更多相关文章

Starship Troopers Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15065 Accepted Submission(s): 4046 Problem Description You, the leader of Starship Troopers, are sent to destroy a base of the bu…
Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14426    Accepted Submission(s): 3887 Problem Description You, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base…
题目大意:给一棵有根带点权树,并且给出容量.求在不超过容量下的最大权值.前提是选完父节点才能选子节点. 题目分析:树上的分组背包. ps:特判m为0时的情况. 代码如下: # include<iostream> # include<cstdio> # include<vector> # include<cstring> # include<algorithm> using namespace std; const int N=105; const…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1011 思路:很明显的树形背包 定义dp[root][m]表示以root为根,派m个士兵的最优解,那么dp[root][m]=max(dp[root][m],dp[root][k]+dp[son][j]) k+j<=m son为root 的孩子 树形dp的思路一般就是着父亲和孩子节点之间的转移关系,然后从dfs到叶子节点,然后开始从叶子节点向上进行DP 最重要的就是建树和dfs求解的过程,如果掌握了怎…
Starship Troopers Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15457    Accepted Submission(s): 4152 Problem Description You, the leader of Starship Troopers, are sent to destroy a base of t…
Problem Description You, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base is built underground. It is actually a huge cavern, which consists of many rooms connected with tunnels. Each room is occupied by some bugs, an…
Starship Troopers Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11476    Accepted Submission(s): 3166  Problem Description You, the leader of Starship Troopers, are sent to destroy a base of…
题目链接:  HDU 1011 树形背包(DP) Starship Troopers 题意:  地图中有一些房间, 每个房间有一定的bugs和得到brains的可能性值, 一个人带领m支军队从入口(房间1)进入, 只有到达某个房间并且将bugs全部杀死, 才能得到相应该的值. 问最多能获得多少可能性值. PS  1). 一支军队能杀死 20 bugs,  当一支军队发生战争之后就不能再到其它地方去了 2) . 不能走回头路 分析:  [树形背包] 用dp[i][j]表示到达房间 i 的军队数为…
Starship Troopers Problem Description You, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base is built underground. It is actually a huge cavern, which consists of many rooms connected with tunnels. Each room is occupie…
Starship Troopers Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17498    Accepted Submission(s): 4644 Problem Description You, the leader of Starship Troopers, are sent to destroy a base of t…