DP
yamatsui
这个作者很懒,什么都没留下…
展开
-
hdu 1003 Max Sum
题源 本来以为只是简单的求出最大子序列就好了,结果又仔细一看题目,还需要区间范围,结果我就懵了,上网百度了一下,发现使用dp. 代码如下: #include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int MAX = 1e6 + 1; int num...原创 2019-04-11 16:08:58 · 126 阅读 · 0 评论 -
HDU 1080 Human Gene Functions
最长公共子序列的变形。。。。。。。看了别人的题解终于明白怎么回事了,果然动态规划博大精深。 这是题源 以下是代码: #include <iostream> #include <cstdio> #include <map> #include <algorithm> #include <cstring> #include <string...原创 2019-04-13 00:13:05 · 133 阅读 · 0 评论 -
poj 1651 Multiplication Puzzle
题源 区间dp dp[i][j]表示区间i到j的最小值,而i<k<j,表示最后选择第k个数的情况 代码如下: #include <iostream> #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; const ll MAX = 1000...原创 2019-04-13 14:37:11 · 104 阅读 · 0 评论 -
HDU 2571 命运
题源 这是一道简单的dp,然而我花了不少时间。。。。。 关键是这题有负数存在,所以初始化的时候要小心一点,还有关键的dp[0][1] = dp[1][0] = 0,(这么基础的地方卡了我好久) 下面是代码: #include <iostream> #include <algorithm> #include <cstdio> #include <vector...原创 2019-06-04 18:48:51 · 149 阅读 · 0 评论