ACM DP
文章平均质量分 67
岁月静好lzz
这个作者很懒,什么都没留下…
展开
-
HDU 4053 or ZOJ 3541 The Last Puzzle 区间dp
HDU 4053 ,提交返回WA,可能是spj有问题吧,害我提交n次以后伤心不已。。。#include #include #include using namespace std;const int maxn=220;int n;int t[maxn],d[maxn],ans[maxn];int dp[maxn][maxn][2];int w[maxn][maxn][2];原创 2013-11-28 17:58:05 · 1254 阅读 · 0 评论 -
HDU 4055 Number String dp
题意大概是给一个长度为n,n后一个数比前一个小,'?'表示大小任意。解题思路:首先想到了一个dp的n^3的算法,状态dp[i][x]表示如果第i个数是剩下的所有数的第x大的,那么之后的序列还有多少种构造方法。那么很容易知道,最后的答案是res=dp[1][1]+dp[1][2]+dp[1][3]+...+dp[1][n+1];状态转移也很容易,if (从i到i+1是增) dp[i][x原创 2013-11-29 20:01:49 · 553 阅读 · 0 评论 -
HDU 4084 Campus Design 状压dp
题意:在n*m的格子里面放1*1和1*2的砖块,要求不能放在格子为0的地方,并且使用1*1的数目在[c,d]之间,求方案总数。想了一天也没有想到有效的转移,其实是陷入了一种错误的想法中,转移应该是一块一块的,不应该是一层一层的,终于在看过了别人的代码以后明白了。#include #include #include using namespace std;const int mod原创 2013-12-02 13:45:23 · 853 阅读 · 0 评论 -
HDU 4765 Tsp 2013长春网络赛G题 DP
第一次看这个题的时候,没有完全的弄清楚给出的三个条件,导致理解出现偏差,之后又重新理了一下题意,终于搞清楚它的意思。题意:卡车司机要送n件货物,从i+点收货,送到i-点,卡车就是一个栈,后收的货物要先送。重点就是这3句话+Mo cannot visit any location more than once.- Mo can't go to location j+ from i原创 2013-12-05 15:21:28 · 1392 阅读 · 0 评论 -
ZOJ 3741 Eternal Reality 简单DP
被Level 6坑了,不解释。。。#include #include #include using namespace std;const int maxn=320;int t,n,x,y;int a[maxn];int dp[maxn];int work(int i){ return(a[i]<=t?1:0);}int main(){ // freo原创 2014-01-12 18:10:59 · 700 阅读 · 0 评论 -
HDU 4906 Our happy ending 状压DP
题意:给 出 n,k原创 2014-08-03 12:28:00 · 544 阅读 · 0 评论