![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
基础dp
文章平均质量分 63
lalala???
这个作者很懒,什么都没留下…
展开
-
leetcode 第 59 场双周赛 5837. 划分数字的方案数 题解
前置知识:后缀数组,RMQ区间最值,简单dp。首先我们会想到使用dp的思路来解决,dp[i][j] 表明当前第i个位置为结尾往前j个位置截取出来当作一个数的方案数,dp[i][j] 就是对于 i-j+1 位置为结尾上小于当前截取的值的方案数的和,因为每次要选取不同的j,这样就是n的平方的时间复杂度,还要每次比对数的大小是n的时间复杂度,最终的时间复杂度就是n的三次方。仔细思考一下,发现只能简化数字的对比,字符串排序就能得到大小,只要求出 rank[i-j+1] +1 和 rank[i-j-j+1]原创 2021-08-22 01:02:10 · 195 阅读 · 0 评论 -
C - Monkey and Banana
A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monk...翻译 2018-08-17 19:48:10 · 243 阅读 · 0 评论 -
L - Common Subsequence
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another sequence Z = < z1, z2, ..., zk > is a ...原创 2018-08-20 10:39:42 · 175 阅读 · 0 评论 -
J - FatMouse's Speed
FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence...原创 2018-08-20 10:08:29 · 284 阅读 · 0 评论 -
I - 最少拦截系统
某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统...原创 2018-08-20 09:31:46 · 109 阅读 · 0 评论 -
H - Tickets
Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could he go back home as early as...原创 2018-08-20 09:29:56 · 305 阅读 · 0 评论 -
G - 免费馅饼
都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝...原创 2018-08-20 09:23:47 · 833 阅读 · 0 评论 -
F - Piggy-Bank
Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple...原创 2018-08-20 09:19:40 · 137 阅读 · 0 评论 -
E - Super Jumping! Jumping! Jumping!
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 you now. The game ...原创 2018-08-20 09:15:44 · 238 阅读 · 0 评论 -
B - 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 te...原创 2018-08-17 08:44:20 · 134 阅读 · 0 评论 -
A - Max Sum Plus Plus
Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem. Given...翻译 2018-08-17 08:27:51 · 321 阅读 · 0 评论 -
M - Help Jimmy
"Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度无限。 Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当Jimmy落到某个平台上时,游戏者选择让它向左还是向右跑,它跑动的速度也是1米/秒。当Jimmy跑到平台的边缘时,开始继续下落。Jimmy每次下落的高度不能超过...原创 2018-08-22 17:29:39 · 224 阅读 · 0 评论