动态规划
文章平均质量分 73
w1997t
ACM:从入门到入土
展开
-
【LCS】POJ1458-Common Subsequence(模板)+LCS 的DP值算法解释
LCS的DP值算法解释 看这篇文章之前,请先看下上面的视频(放心吧,绝对无公害放心视频0.0) 其实 我也是第一次接触这种问题LCS ,最大公共子序列,一开始我就想着直接暴力求解吧,但果不其然,想侥幸但还是超时,所以一时半会我也不知道怎么做了,所以就看了这篇文章: 大佬解释 里面解释的很详细,所以 看完也就懂了 啥意思了 所以 我也就不多说啥了,直接把代码写下来,当做留念吧:转载 2017-08-07 16:46:33 · 273 阅读 · 0 评论 -
HDU 1029 Ignatius and the Princess IV
"OK, you are not too bad, em... But you can never pass the next test." feng5166 says. "I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to原创 2017-08-07 16:48:36 · 155 阅读 · 0 评论 -
杭电 【1003】 Max Sum
Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 +原创 2017-08-08 10:50:28 · 173 阅读 · 0 评论 -
HDU 【1087】Super Jumping! Jumping! Jumping
Problem Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to yo原创 2017-08-08 20:20:04 · 135 阅读 · 0 评论 -
hduoj【1257】最少拦截系统(LIS详解)
前面通过一道题写过关于LCS的解释 今天讲了LIS,于是再说一下LIS的知识 二.LIS(hdoj1257) 1.O(n²)算法 定义dp[i]:以ai为结尾的最长上升子序列的长度 以ai结尾的上升子序列是: ①只包含ai的子序列 ②在满足jji的以aj为结尾的上升子列末尾,追加上ai后得到的子序列 综合以上两种情况,便可以得到递推关系式: dp[i] =原创 2017-08-09 18:24:54 · 845 阅读 · 1 评论 -
LCS 51NOD 最长公共子序列问题
前面写过这个程序 但那个只是简单的把公共子序列长度求出来了,在这里,我把“把公共最长子序列中的一个输出出来”这个程序写一下,具体问题请看 LCS详解 传送门 biu~~~ 直接发代码了: #include #include #include using namespace std; char a[1005],b[1005]; int dp[1005][1005]; int di[1005原创 2017-08-10 20:57:55 · 184 阅读 · 0 评论