文件名称:rootdp
介绍说明--下载内容均来自于网络,请自行研究使用
题意:a->b c :攻克b城堡前要先攻克a城堡攻克b城堡将获得c
共有n个城堡(编号为-n)最多攻克m个城堡能获得的最大收益
把作为树的根把节点连成一棵树
p[root][i]表示在以root为根的子树中选取i个点能获得的最大收益
p[root][i]=max(p[root][i],p[root][i-j]+p[v[e]][j])
当root!=0时每棵子树根必选所以p[root][i]=p[root][i-1]+val[root]
结果为p[0][m]
-Meaning of the questions: a-> bc: overcome b Castle before the first capture of a castle overcome b Castle will get c
The total n Castle (number-n) up to overcome the m castles can get maximum benefit
The root of the tree as a node connected into a tree
p [root] [i] i points to get selected in the sub-tree root-root maximum benefit
p [root] [i] = max (p [root] [i], p [root] [ij]+ p [v [e]] [j])
When the root! = 0 Meike subtree root Required so p [root] [i] = p [root] [i-1]+ val [root]
The result is p [0] [m]
共有n个城堡(编号为-n)最多攻克m个城堡能获得的最大收益
把作为树的根把节点连成一棵树
p[root][i]表示在以root为根的子树中选取i个点能获得的最大收益
p[root][i]=max(p[root][i],p[root][i-j]+p[v[e]][j])
当root!=0时每棵子树根必选所以p[root][i]=p[root][i-1]+val[root]
结果为p[0][m]
-Meaning of the questions: a-> bc: overcome b Castle before the first capture of a castle overcome b Castle will get c
The total n Castle (number-n) up to overcome the m castles can get maximum benefit
The root of the tree as a node connected into a tree
p [root] [i] i points to get selected in the sub-tree root-root maximum benefit
p [root] [i] = max (p [root] [i], p [root] [ij]+ p [v [e]] [j])
When the root! = 0 Meike subtree root Required so p [root] [i] = p [root] [i-1]+ val [root]
The result is p [0] [m]
(系统自动生成,下载前可以参看下载内容)
下载文件列表
hdu1561树形DP.doc