01 2013 档案
摘要:hdu 2280(DP)View Code 1 #include<cstdlib> 2 #include<cstdio> 3 #include<iostream> 4 #include<algorithm> 5 #include<cmath> 6 #include<cstring> 7 using namespace std; 8 const int m=5; 9 const int oo=5100;10 int dp[1010][40];11 int n,c;12 int mz[1010];13 void dfs(int
阅读全文
摘要:想了好久才看懂大牛的结题报告,附上链接:http://blog.csdn.net/cyberzhg/article/details/7840922自己理解,整理下:刚开始的时候陷入了一个误区,枚举所有点把他们当树根,然后递推:dp[rt][0]+=min(dp[son][0]-ca,dp[son][1]);很明显这个递推是每次全部取固定为子树根了,情况不完全;也就是二维不能完全表示状态;dp[N][2][2]dp[rt][0][0]:表示以rt为树根的子树根节点选择了A,但是与根节点A联通的块内(即各个子树的根也选了A,由根节点也选A,连通起来的连通块)没有一个是完全花费的(没有确定起点);d
阅读全文

浙公网安备 33010602011771号