
ACM/树形DP
文章平均质量分 75
Magic_____
当神已无能为力便由魔来普度众生
展开
-
ural 1108 Binary Apple Tree
二叉苹果树题目意思:有一棵苹果树,苹果树的是一棵二叉树,共N个节点,树节点编号为1~N,编号为1的节点为树根,边可理解为树的分枝,每个分支都长着若干个苹果,现在要要求减去若干个分支,保留M个分支,要求这M个分支的苹果数量最多。树形DP将边的值转化成了点的值,方便处理#include#includeusing namespace std;#def原创 2013-07-18 16:52:34 · 1100 阅读 · 0 评论 -
NOI 2003 逃学的小孩
提交网址:http://acm.nankai.edu.cn/p1092.html1092: 逃学的小孩 Time Limit: 1500 ms Memory Limit: 32000 kB Judge type: Multi-casesFont Style:AaAaAaChris家的电话铃响起了,里面传出了Chris的老师焦急的声音:“喂,是Ch原创 2013-07-23 13:58:42 · 1631 阅读 · 0 评论 -
Hdu 1054 Strategic Game
Strategic GameTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3714 Accepted Submission(s): 1630Problem DescriptionBob enjoys pl原创 2013-07-22 10:14:31 · 947 阅读 · 0 评论 -
树形DP总结
必要条件:子树之间不可以相互干扰,如果本来是相互干扰的, 那么我们必须添加变量使得他们不相互干扰。 树形动态规划通常从叶节点(边界)开始逐步向上一层的节点(即父节点)进行状态方程的转移,直到根节点。 树形分组背包原创 2013-07-22 18:53:38 · 888 阅读 · 0 评论 -
Vijos 1100 加分二叉树
描述设一个n个节点的二叉树tree的中序遍历为(l,2,3,…,n),其中数字1,2,3,…,n为节点编号。每个节点都有一个分数(均为正整数),记第i个节点的分数为di,tree及它的每个子树都有一个加分,任一棵子树subtree(也包含tree本身)的加分计算方法如下:subtree的左子树的加分× subtree的右子树的加分+subtree的根的分数若某个子树为空,规定其加分原创 2013-07-22 16:37:16 · 964 阅读 · 0 评论 -
Hdu 2412 Party at Hali-Bula
Party at Hali-BulaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionDear Contestant,I'm going to have a party at my villa at Hali-Bu原创 2013-07-22 12:30:42 · 1050 阅读 · 0 评论 -
POJ 1947 Rebuilding Roads
Rebuilding RoadsTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 7940 Accepted: 3534DescriptionThe cows have reconstructed Farmer John's farm, with its N b原创 2013-07-21 13:31:26 · 783 阅读 · 0 评论 -
Hdu 1520 Anniversary party
Anniversary partyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionThere is going to be a party to celebrate the 80-th Anniversary of th原创 2013-07-21 15:36:51 · 783 阅读 · 0 评论 -
POJ 2486 Apple Tree
Apple TreeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6148 Accepted: 1986DescriptionWshxzt is a lovely girl. She likes apple very much. One day HX tak原创 2013-07-20 11:16:59 · 922 阅读 · 0 评论 -
POJ 3345 Bribing FIPA
Bribing FIPATime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3209 Accepted: 1016DescriptionThere is going to be a voting at FIPA (Fédération Internatio原创 2013-07-20 15:18:06 · 866 阅读 · 0 评论 -
Poj 1155 TELE
TELETime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2983 Accepted: 1525DescriptionA TV-network plans to broadcast an important football match. Their netwo原创 2013-07-19 09:39:29 · 897 阅读 · 0 评论 -
CSU 1317 Find the max Link
1317: Find the max LinkTime Limit: 1 Sec Memory Limit: 128 MB[Submit][Status][Web Board]Description由N个点组成的无向图,每条边有对应的权值,保证每两点之间存在且仅存在一条路径,一条路径的权值为其所有边的权值之和,请找出一条路径,对于图中每个点至多经过一次,并且这条路原创 2013-09-01 16:04:08 · 863 阅读 · 0 评论