2015年2月1日

poj2955(区间dp)

摘要: 题目连接:http://poj.org/problem?id=2955题意:给一个由()[]四种字符任意排列组成的字符串,求最长合法的不连续字串的长度。分析:如果找到一对匹配的括号[xxx]oooo,就把区间分成两部分,一部分是xxx,一部分是ooo,然后以此递归直到区间长度为#include #i... 阅读全文

posted @ 2015-02-01 23:23 lienus 阅读(278) 评论(0) 推荐(0)

poj3280(区间dp)

摘要: 题目连接:http://poj.org/problem?id=3280题意:给定一个长度为m(m#include #include #include #include #include #include #include #include #include #include #include #de... 阅读全文

posted @ 2015-02-01 22:46 lienus 阅读(205) 评论(0) 推荐(0)

poj1651(区间dp)

摘要: 题目连接:http://poj.org/problem?id=1651题意:给出一组N个数,每次从中抽出一个数(第一和最后一个不能抽),该次的得分即为抽出的数与相邻两个数的乘积。直到只剩下首尾两个数为止。问最小得分?分析:区间dp,记忆化搜索,dp[l][r]表示去掉l~r中所有数(不包括l、r)后... 阅读全文

posted @ 2015-02-01 20:16 lienus 阅读(289) 评论(0) 推荐(0)

hdu5001(概率dp)

摘要: 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5001题意:一个人随即从一个点出发,到达邻接点的概率相同,求出走d步都不会到达1~n点的每一点i的概率。分析:每次删掉i点去计算d步后到达其他点的概率,加起来的都是没有到达i点的概率。一开始算出x步到达每... 阅读全文

posted @ 2015-02-01 16:50 lienus 阅读(128) 评论(0) 推荐(0)

hdu4389(数位dp)

摘要: 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4389题意:f(x)表示x各位的数字和. 给定1#include #include #include #include #include #include #include #include #inclu... 阅读全文

posted @ 2015-02-01 14:57 lienus 阅读(149) 评论(0) 推荐(0)

hdu4352(数位dp)

摘要: 题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4352题意:求区间L到R之间的数A满足A的的数位的最长递增序列的长度为K的数的个数。分析:数位dp,dp[i][j][k]表示后面还有i位,此时状态为k,最长上升子序列为j时的总数(在非限制即0~9任意填... 阅读全文

posted @ 2015-02-01 13:05 lienus 阅读(204) 评论(0) 推荐(0)

导航