Starship Troopers】的更多相关文章

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…
Starship Troopers Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) 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 h…
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…
Starship Troopers Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8540    Accepted Submission(s): 2379 Problem Description You, the leader of Starship Troopers, are sent to destroy a base of t…
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, and their brains hide…
Starship Troopers Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19362 Accepted Submission(s): 5130 Problem Description You, the leader of Starship Troopers, are sent to destroy a base of the bu…
Starship Troopers Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20833    Accepted Submission(s): 5550 Problem Description   You, the leader of Starship Troopers, are sent to destroy a base of…
Starship Troopers Time Limit: 5000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 101164-bit integer IO format: %I64d      Java class name: Main     You, the leader of Starship Troopers, are sent to destroy a base of the bug…
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…
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…
本来是一道很水的树形DP题 设dp[i][j]表示,带着j个人去攻打以节点i为根的子树的最大收益 结果wa了一整晚 原因: 坑点1: 即使这个节点里面没有守卫,你如果想获得这个节点的收益,你还是必须派一个人去这个节点,不然谁帮你去拿收益? 坑点2: 题目说是从节点1开始攻打,然后我就以为给出的数据都是以1为根节点的,就没有加双向边 不过, 最后我加了双向边,然后还是wa了 又找了很久,最后发现是前向星的数组开小了 注意:数组开小了可能会返回wa,tle,re等等等等 #include<cstdi…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1011 dp[u][i]为以u为根节点的,花了不超过i元钱能够得到的最大价值 因为题目里说要访问子节点必须先访问根节点,所以 dp[u][i+j] = max(dp[u][i],dp[u][i]+dp[v][j]); v是u的儿子节点. 代码: import java.util.*; import static java.lang.Math.*; class Graph{ ArrayList<Arra…
第一道树形DP.很容易理解. #include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 105 typedef struct { int n, p; } room_t; room_t rooms[MAXN]; int adj[MAXN][MAXN]; int dp[MAXN][MAXN]; bool visit[MAXN]; int n, m; int max(int a, int b) {…
题意: 给定n个定点和m个士兵,n个定点最终构成一棵树,每个定点有一定x个bugs和y个value,每20个bug需要消耗一个士兵,不足20也消耗一个,然后最终收获y个value,只有父节点被占领后子节点才有被占领的可能. DP状态转移方程: dp[p][j]=max(dp[p][j],dp[p][j-k]+dp[t][k]); 看的王大神的代码,DFS写的,先从叶子节点开始向上遍历进行动态规划,自己看了dp方程也没写出来.. #include <iostream> #include <…
本文出自   http://blog.csdn.net/shuangde800 题目链接 : hdu-1011   题意 有n个洞穴编号为1-n,洞穴间有通道,形成了一个n-1条边的树, 洞穴的入口即根节点是1. 每个洞穴有x只bugs,并有价值y的金子,全部消灭完一个洞穴的虫子,就可以获得这个洞穴的y个金子. 现在要派m个战士去找金子,从入口进入.每次只有消灭完当前洞穴的所有虫子,才可以选择进入下一个洞穴. 一个战士可以消灭20只虫子,如果要杀死x只虫子,那么要x/20向上取整即(x+19)/…
题目链接: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求解的过程,如果掌握了怎…
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1011 题意:打洞洞收集脑子,你带领一个军队,洞洞互联成一棵树,每个洞中有一些bug,要全部杀死这些虫子才可以取得这个洞中的脑子,只有杀死当前节点的bug才可以继续走下去,且如果有0个bug你仍要派遣一个士兵在这里,只不过可以士兵不停留. 题解:很清晰明了的树形dp了,但是某些人说过写题解就要写细致...所以我们还是来详细讲解一下树形dp吧... 树形dp: 这是一个很裸的树形dp,和一般的dp不同的…
http://acm.hdu.edu.cn/showproblem.php?pid=1011   题意:每个节点有两个值bug和brain,当清扫该节点的所有bug时就得到brain值,只有当父节点被清空时,才可以清扫它          的子节点,而清扫需要一定的人员.给定M个人员,N个结点的树,求最大brain和   这看起来是一道非常简单的背包dp 但是 写完提交wa之后,我发现这道题,并不简单!因为他的题意并不是完全和我找到的题意一样(我承认我语文很差劲所以随便找个题解看题意..),题目…
题意 有n个洞穴编号为1-n,洞穴间有通道,形成了一个n-1条边的树, 洞穴的入口即根节点是1. 每个洞穴有x只bugs,并有价值y的金子,全部消灭完一个洞穴的虫子,就可以获得这个洞穴的y个金子. 现在要派m个战士去找金子,从入口进入.每次只有消灭完当前洞穴的所有虫子,才可以选择进入下一个洞穴. 一个战士可以消灭20只虫子,如果要杀死x只虫子,那么要x/20向上取整即(x+19)/20个战士. 如果要获得某个洞穴的金子,必须留下足够杀死所有虫子的战士数量, 即(x+19)/20个战士,然后这些留…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1011 题意: 题目大意是有n个房间组成一棵树,你有m个士兵,从1号房间开始让士兵向相邻的房间出发,每个房间里有一个代价,代价是值/20个士兵, 同时有一个价值,问你花费这m个士兵可以得到的最大价值是多少. 思路: 树上背包,这题比较坑爹.士兵为0,输出0.要是一个房间的cost不足20的倍数也要补全20的倍数. dp[i][j]表示以i节点为子树的root使用j个士兵的最大价值( 不用管父节点 ),…
题目大意:给定一棵 N 个节点的无根树,每个节点有一个重量和一个价值,现给出一些单位,每个单位可以接受 20 个重量单位,求如何分配这些单位,使得获得的价值最大. 题解:dp 好题qwq..真的毒瘤. 状态转移很好设计,\(dp[i][j]\) 表示以 i 为根节点的子树中,分配 j 个单位可以获得的最大价值是多少,转化成分组背包. 需要注意的点如下: 对于公式\[\lfloor {n+m-1\over m} \rfloor\]与公式\[\lfloor {n-1\over m} \rfloor+…
1. Standard Iterative Branching model   Source Code   Butterfly Effect   Next   Edge of Tomorrow   Donnie Darko (recommended by dhetti, pending review)2. Scientific Space Time (Strong General Relativity) model   Interstellar2b. Less-scientific Space…
切题ing!!!!! HDU  2196 Anniversary party 经典树形DP,以前写的太搓了,终于学会简单写法了.... #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <map> #include <queue> #include <set>…
1. Introduction The Saga of Ryzom is a persistent massively-multiplayer online game (MMORPG) released in September 2004 throughout Europe and North America, localised in 3 languages so far. It has been developed by Nevrax since 2000, and was taken ov…