
区间dp
文章平均质量分 71
sega_handsome
这个作者很懒,什么都没留下…
展开
-
Coloring Brackets CodeForces - 149D 区间dp
分析: 自己也想到了用四维数组存 但是我逗比地用了dp[l][r]=dp[l+1][r]+dp[l][r-1];。、 还是做题少。。也许我还是应该多看看题解。。(要不然想错了。。然后自己没有锻炼到能力,又白白走神) 只不过重点是看过题解之后自己能不看代码敲出来; 或者看了代码之后能不看代码敲出来。。这样就理解了。。 再次低效。。 有时候觉得还会转载 2017-04-27 20:45:34 · 276 阅读 · 0 评论 -
区间dp POJ 3186
自己一看就没有什么思路,在想着怎么处理前面选和后面选的问题,然后就看题解了,看了题解后,想:状态转移就看我有多少种选择,这里有 前面选和后面选两种,,, 那么就是状态转移的关键了, 那我的dp 要怎么定义才可以达到状态专一的时候表达的出来呢? 题解一: 状态: d[i][j]表示第i个到第j个的最大值 状态转移方程: d[i][j]=ma原创 2017-03-07 16:22:32 · 213 阅读 · 0 评论 -
Codeforces Round #426 (Div. 2) D. The Bakery(DP+线段树) 好题
http://codepad.org/MXUIg5lP转载 2017-08-18 16:05:18 · 237 阅读 · 0 评论 -
[CodeForces-758D] 区间dp
Input16 11311Output475Input20 999Output3789Input17 2016Output594 NoteIn the first example 12 could be obtained by converting two numbers to the system with base 13: 12 = 12·130 or 15 = 1·131 + 2·130. 参原创 2017-08-21 20:46:49 · 256 阅读 · 0 评论 -
Codeforces Round #272 (Div. 2) E. Dreamoon and Strings 动态规划
http://codeforces.com/contest/476/problem/E 参考http://www.cnblogs.com/qscqesze/p/5794709.html题意给你一个串S,和另外一个串P把k从0到|S|枚举,然后问你去掉k个字符后,s串里面最多有多少个不重叠的p字符串 题解:dp,dp[i][j]表示考虑到第i个位置,去掉了j个字符的最大值然后我们对于每一个位置,先暴转载 2017-09-19 20:35:37 · 375 阅读 · 0 评论 -
CF:Problem 383D - Antimatter 分治DP
参考:http://blog.youkuaiyun.com/u011466175/article/details/19689665 题目:http://codeforces.com/contest/383/problem/D D. Antimatter time limit per test 1 second memory limit per test 256 megabytes input转载 2017-11-29 14:51:54 · 228 阅读 · 0 评论 -
Codeforces Beta Round #17 C. Balance DP
C. Balance 题目链接http://codeforces.com/contest/17/problem/C 题面Nick likes strings very much, he likes to rotate them, sort them, rearrange characters within a string… Once he wrote a random string of ch转载 2017-12-03 11:12:15 · 323 阅读 · 0 评论 -
uva 4857 区间dp
自己没有想出来,, 也想过逆推, 但是在dp[i][j] = min(dp[i + 1][j] + 1, dp[i + 1][k - 1] + dp[k][j])。//中,我没有想到有 dp[i + 1][k - 1] ,其实这个是代表脱掉这些衣服。 转自:http://blog.youkuaiyun.com/fungyow/article/details/47358821 题意:Gappu有n转载 2017-04-26 19:56:29 · 207 阅读 · 0 评论 -
UVA10559 Blocks
转自:http://blog.youkuaiyun.com/hyqsblog/article/details/46288923 这就是未来费用吗。。那人的代码真好 UVA10559 Blocks #include #include #include #include #include #include #include #include #include #in转载 2017-05-06 15:45:48 · 223 阅读 · 0 评论 -
HDU2476:String painter 区间dp
转自:http://blog.youkuaiyun.com/libin56842/article/details/9708807 还是看不懂。。dp[i][j]=min(dp[i][j],dp[i+1][k]+dp[k+1][j]); 为什么是这公式 #include using namespace std; #define bug1 printf("bug1\n"); #def转载 2017-04-30 20:47:30 · 245 阅读 · 0 评论 -
Cake ZOJ - 3537 区间dp
自己查错的时候的方向太逗比了。。 就是最后应该使用做完凸包后的res 点的坐标来弄。。 我却还是用原来的node 结果就会有点弄不到。。 我的debug应该要在关键位置才可以啊。 #include #include #include #include #include #include using namespace std; #define rep(x,n) f转载 2017-04-28 10:32:11 · 221 阅读 · 0 评论 -
Multiplication Puzzle POJ - 1651 区间dp
转自:http://blog.youkuaiyun.com/power721/article/details/5804319 自己实在太逗了。。 因为有个数拿了之后会对后面有影响。。 所以我还打算把a[I]=0,然后dfs来记录,,但是不太可能表示状态。。; 然后看了别人的题解。。 其实这就只是 这道题实质上就是矩阵连乘, 动态规划——矩阵连乘问题 因为: 如转载 2017-04-28 12:10:32 · 251 阅读 · 0 评论 -
uva1631 Locker 记忆化搜索
自己想用d[I][j], 然后不会了。。 然后看别人的题解,感觉好巧妙。。 他这里之所以枚举是因为 1000*10*10*10 用了记忆化搜索后并不会TLE , 可能自己连暴力, 模拟的这一块都还么有搞清楚。。 #include #include #include #include #include #include #include #include #include #转载 2017-04-18 20:06:32 · 440 阅读 · 0 评论 -
HDU4283:You Are the One(区间DP)
转自:http://blog.youkuaiyun.com/libin56842/article/details/9722077 自己还是不会。。 关键在于找子问题和决策,,, 他这里很详细。。 决策就分。。。 第一个,第k个,(k为1~n),,这样的话就是枚举了。。‘(一般都要这种枚举的过程)转载 2017-04-30 11:57:11 · 213 阅读 · 0 评论