2013年6月12日
摘要: 题目链接。题意:给定义个多叉树,每个结点上都有一个权值。子结点和父结点不能同时选。求最大的权值和。分析:利用左儿子右兄弟原则转化成二叉树,DP。代码如下:#include <iostream>#include <cstring>#include <cstdio>#include <cstdlib>using namespace std;const int maxn = 6000 + 10;struct Tree { int father, child, brother; int Take, Not; void init() { father = 阅读全文
posted @ 2013-06-12 11:21 Still_Raining 阅读(284) 评论(0) 推荐(0)