摘要: http://poj.org/problem?id=1848DP, 树状DP一个节点形成环的过程中只有3种状态,0:有0条边连着这个点1:有1条边连着这个点2:有2条边连着这个点转移还可以再优化,不过不太好写,直接上3层循环。。。代码中inf的定义:至少要添无穷多个边,才可以满足要求 ---等价于---> 添多少都没用 1 #include <stdio.h> 2 #include <vector> 3 #define N 123 4 5 using namespace std; 6 7 vector<int> a[N]; 8 int mark[N], 阅读全文
posted @ 2013-05-22 16:58 Yuan1991 阅读(143) 评论(0) 推荐(0)