摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1054题意:在一个树中有一些结点,若在一个结点占一个士兵,则和这一节点相邻的结点被控制(包括此节点),求最少需要多少个士兵;思路:用树形dp,num[i][2]数组存储这个结点存在和不存在士兵的情况下子节点所需士兵的最少数目;code:View Code #include <iostream>#include <algorithm>#include <cstdio>#include <cstring>using namespace std;struct node 阅读全文
posted @ 2012-04-23 20:55 LT-blogs 阅读(204) 评论(0) 推荐(0) 编辑