随笔分类 -  区间DP

HDU 2476 String painter (区间DP)
摘要:String painterTime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1117Accepted Submission(s): 443Problem DescriptionThere are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. 阅读全文

posted @ 2013-04-30 16:36 kuangbin 阅读(3558) 评论(1) 推荐(0) 编辑

ZOJ 3469 Food Delivery(区间DP)
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4255DP的思路就是,如果要访问完[i,j],那么它的子区间一定访问完了。用dp[i][j][0]表示访问完区间[i,j]并留在左端点,dp[i][j][1]表示访问完区间[i,j]并留在右端点。把饭店那个地方也加进去作为点。从饭店那个点往两边进行DP;dp[i][j][0] 可以根据dp[i+1][j][0]和dp[i+1][j][1]得到。dp[i][j][1] 可以根据dp[i][j-1][0]和dp[i][j-1][1]得到。//============== 阅读全文

posted @ 2013-04-30 14:59 kuangbin 阅读(1586) 评论(0) 推荐(0) 编辑

POJ 1651 Multiplication Puzzle(区间DP)
摘要:题目链接:http://poj.org/problem?id=1651Multiplication PuzzleTime Limit:1000MSMemory Limit:65536KTotal Submissions:5000Accepted:2988DescriptionThe multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and score 阅读全文

posted @ 2013-04-30 00:42 kuangbin 阅读(1733) 评论(0) 推荐(0) 编辑

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 阅读(1586) 评论(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: