![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dp 动态规划
obsorb_knowledge
心有不甘,呼唤着我
展开
-
5. 最长回文子串 区间dp和拉马车算法
区间dp原创 2021-12-31 10:33:47 · 434 阅读 · 0 评论 -
king's trouble II SCU - 4488 (dp,找正方形,dp 最左最右边界 或者 直接dp )
DescriptionLong time ago, a king occupied a vast territory.Now there is a problem that he worried that he want to choose a largest square of his territory to build a palace.Can you help him?...原创 2018-04-18 21:16:40 · 184 阅读 · 0 评论 -
组合数学 和 dp 的递推式 和杨辉三角 三者之间的联系
1072: 简单的问题时间限制: 1 Sec 内存限制: 128 MB提交: 26 解决: 6[提交][状态][讨论版]题目描述这个问题太简单了以至于出题人想不到什么捏造什么背景了(脑洞缺失那就让我们直奔主题吧:给你一个n,你能否知道,在[0,n)中,有多少数的二进制表示中1的个数和n的二进制表示中1的个数是一样多的?输入:第一行一个T,表示有T组数据其后T行,每行一个整数,代表n输出:n行每...原创 2018-04-13 11:40:03 · 207 阅读 · 0 评论 -
1071: zdw的嘤嘤嘤(找一字符串的长度,非严格单调递增,(可以用找 非严格单调递增的 dp,写)(也可用找字符串的dp写,这种挺重要))
1071: zdw的嘤嘤嘤时间限制: 1 Sec 内存限制: 128 MB提交: 53 解决: 14[提交][状态][讨论版]题目描述//感觉会被zdw揍众所周知,zdw是一个萌妹,喜欢嘤嘤嘤。而且最擅长八重嘤和嘤雄不朽。这一天zdw说了一个很长的字符串,只包括 ‘y’ , ‘i’ , ‘n’ ,’g’这四个字符。你需要选取尽量多的下标,让这些下标在这个字符串中对应的字符按下标从小到大的顺序组...原创 2018-04-13 16:38:25 · 424 阅读 · 0 评论 -
Nested Dolls HDU - 1677 (矩形嵌套问题,先构造序列,再用upper_bound找最长上升子序列+贪心)
Dilworth is the world’s most prominent collector of Russian nested dolls: he literally has thousands of them! You know, the wooden hollow dolls of different sizes of which the smallest doll is contain...原创 2018-05-15 20:49:00 · 274 阅读 · 0 评论 -
CF 983B XOR-pyramid(区间dp 加 异或)
For an array bb of length mm we define the function ff asf(b)={b[1]f(b[1]⊕b[2],b[2]⊕b[3],…,b[m−1]⊕b[m])if m=1otherwise,f(b)={b[1]if m=1f(b[1]⊕b[2],b[2]⊕b[3],…,b[m−1]⊕b[m])otherwise,where ⊕⊕ is bitwise...原创 2018-05-22 20:22:58 · 253 阅读 · 0 评论 -
扫雷 HDU - 5965 (dp,左右相互影响,但是有固定的起点)
扫雷游戏是晨晨和小璐特别喜欢的智力游戏,她俩最近沉迷其中无法自拔。 该游戏的界面是一个矩阵,矩阵中有些格子中有一个地雷,其余格子中没有地雷。 游戏中,格子可能处于己知和未知的状态。如果一个己知的格子中没有地雷,那么该 格子上会写有一个一位数,表示与这个格子八连通相邻的格子中地雷总的数量。 现在,晨晨和小璐在一个3行N列(均从1开始用连续正整数编号)的矩阵中进 行游戏,在这个矩阵中,第2行的格子全部...原创 2018-05-22 21:49:26 · 245 阅读 · 0 评论 -
CKOJ 1066: 地形编辑器(整个区间加减一个数,多次区间操作,处理端点,但这是二维的,骚操作(有dp思想))
1066: 地形编辑器时间限制: 1 Sec 内存限制: 128 MB提交: 32 解决: 4[提交][状态][讨论版]题目描述zdw很喜欢玩红警, 他经常制作一些奇奇怪怪的红警地图当他制作地图的时候, 经常需要用到地形编辑器zdw可以用这个编辑器将地图上的某个区域的高度改变x来创造地形一次显然是不够的, 而经过若干次的操作后, 地图上将会出现各种山脉和峡谷现给出zdw的所有操作, 求这些操作...原创 2018-05-29 21:11:32 · 546 阅读 · 0 评论 -
石子合并问题--直线版 HRBUST - 1818 (区间dp入门)
一条直线上摆放着一行共n堆的石子。现要将石子有序地合并成一堆。规定每次只能选相邻的两堆合并成新的一堆,并将新的一堆石子数记为该次合并的得分。请编辑计算出将n堆石子合并成一堆的最小得分和将n堆石子合并成一堆的最大得分。Input输入有多组测试数据。每组第一行为n(n<=100),表示有n堆石子,。二行为n个用空格隔开的整数,依次表示这n堆石子的石子数量ai(0<ai<...原创 2018-08-19 11:13:50 · 547 阅读 · 0 评论 -
不要62 HDU - 2089 && Bomb HDU - 3555 (入门数位dp)
杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之...原创 2019-04-09 08:21:18 · 194 阅读 · 0 评论 -
“卓见杯”第五届CCPC中国大学生程序设计竞赛河南省赛网络赛 D Defending Plan Support(树形dp,贡献值,递推)
题目描述The architectural structure of the college is strange, but the rule is that there is only one simple path between every two classrooms. Now the battle between Class A and Class F broke out. As a...原创 2019-04-15 20:56:00 · 381 阅读 · 0 评论 -
第十一届河南省程序设计大赛 C 山区修路 (dp 垫高当前的这个区域的高度 和 或者直接修斜坡公公路,求最小花费)
C 山区修路内存限制:128MB时间限制:3sSpecial Judge: No题目描述:SNJ位于HB省西部一片群峰耸立的高大山地,横亘于A江、B水之间,方圆数千平方公里,相传上古的神医在此搭架上山采药而得名。景区山峰均在海拔3000米以上,堪称"华中屋脊"。SNJ是以秀绿的亚高山自然风光,多样的动植物种,人与自然和谐共存为主题的森林生态区。SNJ处于中国地势第...原创 2019-05-03 15:37:36 · 621 阅读 · 0 评论 -
hdu - 1950 Bridging signals(最长上升序列,dp 二分求法)
'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connecting the ports ...原创 2018-04-07 08:26:11 · 179 阅读 · 0 评论 -
Anniversary party poj 2342(树,树状dp入门 或 两种记忆化搜索可做)
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tr...原创 2018-04-06 20:18:39 · 165 阅读 · 0 评论 -
hdu 1423 dp 求最长公共上升子序列
This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.InputEach sequence is described with M - its length (1 Outputoutput print L - the length of t原创 2017-09-23 09:27:16 · 332 阅读 · 0 评论 -
HDU - 2159 多个限制变量的完全背包
最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最多只杀s只怪。请问他能升掉这最后一级吗?I原创 2017-10-01 10:26:17 · 274 阅读 · 0 评论 -
hdu - 1506 dp ,找最左最右边界
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows原创 2017-08-09 15:18:15 · 315 阅读 · 0 评论 -
CodeForces - 358D dp 每个数取走的贡献与相邻的数有关,状态转移
Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more.Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was ve原创 2017-09-24 16:58:08 · 269 阅读 · 0 评论 -
UVa 1025 (DAG 上的动态规划,有固定终点的最短时间,逆推法)
题目链接题意: 某城市的地铁是线性的,有n(2≤n≤50)个车站,从左到右的编号为1~N.有M1辆列车从第一站开始往右开,还有M2辆列车从第n站开始往左开。在时刻0,Mario从第1站出发,目的是在时刻T(0≤T≤200)会见车站n的一个间谍。在车站等车容易被抓,所以她决定尽量躲在开动的火车上,让在车站等待的总时间尽量短。列车靠站停车时间忽略不计,且Mario身手敏捷,即使两辆方向不同的列车原创 2017-11-23 20:31:29 · 875 阅读 · 0 评论 -
dp 划分数
第一种:求 把n划分为最大值不超过m的 划分数1) 若是划分多个整数可以存在相同的:dp[n][m] 存的是n划分为最大值不超过m的划分个数;dp[n][m] = dp[n][m-1]+dp[n-m][m]; dp[n][m]表示整数 n 的划分中,每个数不大于 m 的划分数。 则划分数可以分为两种情况: a.划分中每个数都小于 m,相当于每个数不大于 m- 1, 故划分数为 dp[n][m-1...原创 2018-03-26 17:56:12 · 692 阅读 · 0 评论 -
Sumsets (dp, 找规律,找递推式)
Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the possible sets of numbers that ...原创 2018-04-03 18:11:52 · 293 阅读 · 0 评论 -
Apple Catching (dp 动态规划)
It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples when they a...原创 2018-04-03 20:21:29 · 308 阅读 · 0 评论 -
Making the Grade POJ - 3666 (dp 离散化 变成 非严格单调递增 或递减)
A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not mind climbing up or down a single slope, but they are not fond of an alternatin...原创 2018-04-17 08:25:41 · 303 阅读 · 0 评论 -
Dollar Dayz poj 3181(dp 完全背包 或 不超过m的划分数)
Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for $1, $2, and $3. Farmer John has exactly...原创 2018-04-06 14:11:47 · 147 阅读 · 0 评论 -
区间dp入门:poj 3280 Cheapest Palindrome poj 2955 Brackets
poj 3280Cheapest PalindromeKeeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system w...原创 2018-04-06 16:50:43 · 122 阅读 · 0 评论 -
CodeForces - 163A dp, a串的子串,b串的子序列看多少相同的对数
One day Polycarpus got hold of two non-empty strings s and t, consisting of lowercase Latin letters. Polycarpus is quite good with strings, so he immediately wondered, how many different pairs of "x原创 2017-09-27 20:14:49 · 397 阅读 · 0 评论