动态规划
文章平均质量分 71
空待待啊
这个作者很懒,什么都没留下…
展开
-
一本通 提高篇—区间类动态规划
文章目录#10147. 「一本通 5.1 例 1」石子合并题目描述输入格式输出格式样例数据范围与提示代码#10148. 「一本通 5.1 例 2」能量项链题目描述输入格式输出格式样例数据范围与提示代码#10149. 「一本通 5.1 例 3」凸多边形的划分#10150. 「一本通 5.1 练习 1」括号配对题目描述输入格式输出格式样例数据范围与提示代码#10151. 「一本通 5.1 练习 2」分离与合体#10152. 「一本通 5.1 练习 3」矩阵取数游戏题目描述输入格式输出格式样例 1样例 2样例 3原创 2022-03-26 09:38:05 · 4859 阅读 · 0 评论 -
Armchairs CodeForces - 1525D 【DP】
题There are n armchairs, numbered from 1 to n from left to right. Some armchairs are occupied by people (at most one person per armchair), others are not. The number of occupied armchairs is not greater than n/2.For some reason, you would like to tell peo原创 2022-03-15 21:37:19 · 566 阅读 · 0 评论 -
#10166. 「一本通 5.3 练习 1」数字游戏【数位 DP】
题目描述由于科协里最近真的很流行数字游戏,某人又命名了一种取模数,这种数字必须满足各位数字之和 mod N为 0。现在大家又要玩游戏了,指定一个整数闭区间 [a,b],问这个区间内有多少个取模数。输入格式题目有多组测试数据。每组只含三个数字 a, b, N。输出格式对于每个测试数据输出一行,表示各位数字和 mod N 为 0 的数的个数。样例Input1 19 9Output2数据范围与提示对于全部数据,1≤ a,b≤231-1,1≤N<100。代码1#includ原创 2022-03-09 22:00:17 · 3428 阅读 · 0 评论 -
#10150. 「一本通 5.1 练习 1」括号配对【DP】
题目描述Hecy 又接了个新任务:BE 处理。BE 中有一类被称为 GBE。以下是 GBE 的定义:空表达式是 GBE如果表达式 A 是 GBE,则 [A] 与 (A) 都是 GBE如果 A 与 B 都是 GBE,那么 AB 是 GBE下面给出一个 BE,求至少添加多少字符能使这个 BE 成为 GBE。输入格式输入仅一行,为字符串 BE。输出格式输出仅一个整数,表示增加的最少字符数。(把所有未配备的括号配备的最少次数)样例Input[])Output1注意这不能看成原创 2022-03-09 10:42:31 · 435 阅读 · 0 评论 -
Apple Catching poj-2385【dp】
题奶牛喜欢苹果,这是一个鲜为人知的事实。农夫约翰在他的地里有两棵苹果树(方便地编号为 1 和 2),每棵苹果树都长满了苹果。当苹果在树上时,贝西无法够到苹果,所以她必须等待它们掉下来。然而,她必须在空中接住它们,因为苹果落地时会擦伤(而且没有人想吃擦伤的苹果)。Bessie 吃得很快,所以她抓到的一个苹果在短短几秒钟内就被吃掉了。 每分钟,两棵苹果树中的一棵会掉落一个苹果。Bessie 经常练习,如果她站在一棵苹果从树上掉下来,她就可以接住一个苹果。虽然 Bessie 可以在两棵树之间快速行走(不到一分钟原创 2022-03-07 20:38:17 · 147 阅读 · 0 评论 -
不要 62(动态规划)
题目描述原题来自:HDU 2089杭州人称那些傻乎乎粘嗒嗒的人为 62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有 4 或 62 的号码。例如:62315,73418,88914 都属于不吉利号码。但是,6115261152 虽然含有 6 和 2,但不是 62连号,所以不属于不吉利数字之列。你的任务是,对于每次给出的一个牌照区间号,推断出原创 2022-01-10 21:03:47 · 83 阅读 · 0 评论 -
POJ-3616 Milking Time(dp)
题Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,000) hours (conveniently labeled 0…N-1) so that she produces as much milk as possible.Farmer John has a l原创 2021-07-30 20:00:21 · 119 阅读 · 0 评论 -
(约瑟夫环)
题Let’s play a stone removing game.Initially, n stones are arranged on a circle and numbered 1, . . . , n clockwise (Figure 1). You are alsogiven two numbers k and m. From this state, remove stones one by one following the rules explainedbelow, until on原创 2021-10-04 21:37:52 · 66 阅读 · 0 评论 -
Making the Grade 【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 alternating succession of hills and valleys. FJ would like to ad原创 2021-10-03 21:05:08 · 243 阅读 · 0 评论 -
POJ - 3280 Cheapest Palindrome(区间dp)
题Keeping 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 will read as the cows pass by a scanner. Each ID tag’s contents are currently a sin原创 2021-10-04 21:53:08 · 103 阅读 · 0 评论