2013年4月29日

POJ 2955 Brackets (区间DP)

摘要: 题目链接:http://poj.org/problem?id=2955BracketsTime Limit:1000MSMemory Limit:65536KTotal Submissions:1977Accepted:1012DescriptionWe give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence,ifsis a regular brackets sequence, then (s) and [ 阅读全文

posted @ 2013-04-29 22:59 kuangbin 阅读(1080) 评论(0) 推荐(0) 编辑

Light OJ 1422 - Halloween Costumes

摘要: 题目链接:http://lightoj.com/volume_showproblem.php?problem=1422很简单的区间DP的入门题。一开始这题想了很久就是想不出来。直到做了后面几道区间DP回过来终于想明白了。区间DP可以使用记忆化搜索和直接DP的方法写。这题的状态转移方程:dp[i][j]=min(1+dp[i+1][j],dp[i+1][k-1]+dp[k][j]) ( a[i]==a[k] i<k<=j )注意初始化。/* * Light OJ 1422 - Halloween Costumes * http://lightoj.com/volume_showpro 阅读全文

posted @ 2013-04-29 22:52 kuangbin 阅读(1592) 评论(0) 推荐(0) 编辑

ZOJ 3735 Cake(区间DP,最优三角剖分)

摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4472开始做下区间DP的题目了。题解可以参照大牛博客:http://blog.csdn.net/woshi250hua/article/details/7824433这题很经典,主要是思路:两种写法写的,一种是DP,一种是记忆化搜索。DP一定要注意循环的顺序。代码一://============================================================================// Name : ZOJ.cp... 阅读全文

posted @ 2013-04-29 10:45 kuangbin 阅读(1234) 评论(0) 推荐(0) 编辑

导航

JAVASCRIPT: