2012年7月30日

摘要: http://acm.bjtu.edu.cn/vjudge/problem/viewProblem.action?id=1815经典的双线程dp,dp[i][x1][y1][x2][y2]表示走i步在(x1,y1),(x2,y2)两点处取得的和的最大值,假设矩阵从0-n-1,有i=x+y,五维转化成三维。代码中用了滚动数组,不过在这里意义不大View Code #include <iostream>using namespace std ;int map[31][31],dp[3][31][31] ;int MAX(int a,int b,int c,int d){ a=max(a 阅读全文
posted @ 2012-07-30 23:07 LegendaryAC 阅读(245) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.bjtu.edu.cn/vjudge/problem/viewProblem.action?id=669最最基础的树形dp,父子兄弟结构太爽了,学自hh博客View Code #include <iostream>using namespace std ;struct Tree{ int father ; int child ; int brother ; int happy ; int temp ; int MAX(){ return max(happy,temp) ; } void init(){ ... 阅读全文
posted @ 2012-07-30 23:01 LegendaryAC 阅读(251) 评论(2) 推荐(0) 编辑