
动态规划
文章平均质量分 84
CNG Steve·Curcy
death is what gives life meaning, to know your days are numbered,your time is short.
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
POJ - 1185 - 炮兵阵地(dp & 状压)
POJ - 1185 - 炮兵阵地 司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用”H” 表示),也可能是平原(用”P”表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示: 如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中的黑...原创 2018-08-18 11:49:10 · 247 阅读 · 0 评论 -
LightOJ - 1031 - Easy Game(区间dp )
You are playing a two player game. Initially there are n integer numbers in an array and player A and B get chance to take them alternatively. Each player can take one or more numbers from the left or...原创 2018-12-03 16:45:30 · 201 阅读 · 0 评论 -
HDU - 2089 不要62(数位dp )
杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之列。 你...原创 2019-01-26 19:07:38 · 176 阅读 · 0 评论 -
HDU 3555 Bomb(数位dp )
Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current...原创 2019-01-27 09:41:27 · 411 阅读 · 1 评论 -
Round Numbers POJ - 3252(数位dp )
The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone’ (also known as ‘Rock, Paper, Scissors’, ‘Ro, Sham, Bo’, and a host of other names) in order to make...原创 2019-01-27 13:52:14 · 168 阅读 · 0 评论 -
Balanced Number HDU - 3709(数位 dp )
A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit. When a pivot is ...原创 2019-02-20 14:25:01 · 130 阅读 · 0 评论 -
B-number HDU - 3652(数位dp )
A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string “13” and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but 143 and 2639 ar...原创 2019-02-20 14:44:51 · 167 阅读 · 0 评论 -
I Love this Game! POJ - 1678(博弈dp )
A traditional game is played between two players on a pool of n numbers (not necessarily distinguishing ones). The first player will choose from the pool a number x1 lying in [a, b] (0 < a < b),...原创 2019-02-21 10:10:42 · 255 阅读 · 0 评论 -
Happy Programming Contest(01背包)
In Zhejiang University Programming Contest, a team is called “couple team” if it consists of only two students loving each other. In the contest, the team will get a lovely balloon with unique color...原创 2019-03-06 16:23:25 · 126 阅读 · 0 评论 -
Dream City ZOJ - 3211(贪心+dp )
JAVAMAN is visiting Dream City and he sees a yard of gold coin trees. There are n trees in the yard. Let’s call them tree 1, tree 2 …and tree n. At the first day, each tree i has ai coins on it (i=1...原创 2019-03-08 12:12:10 · 225 阅读 · 0 评论 -
CodeForces - 510D Fox And Jumping (dp & 数论)
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0. There are also n c...原创 2018-12-29 11:35:52 · 265 阅读 · 0 评论 -
FZU - 2214 - Knapsack problem(背包 & 思维)
Given a set of n items, each with a weight w[i] and a value v[i], determine a way to choose the items into a knapsack so that the total weight is less than or equal to a given limit B and the total va...原创 2018-09-07 09:50:58 · 183 阅读 · 0 评论 -
Table with Letters - 2(dp & 队列思想)
Vasya has recently started to learn English. Now he needs to remember how to write English letters. He isn’t sure about some of them, so he decided to train a little. He found a sheet of squared paper...原创 2019-07-23 13:58:37 · 193 阅读 · 0 评论 -
HihoCoder - 1110 - Regular Expression(区间dp )
Your task is to judge whether the input is a legal regular expression. A regular expression is defined as follow: 1: 0 and 1 are both regular expressions. 2: If P and Q are regular expressions, PQ is ...原创 2018-12-03 16:24:42 · 172 阅读 · 0 评论 -
CodeForces - 608C - Chain Reaction (dp & 二分)
题目链接 There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (di...原创 2018-09-11 10:57:01 · 228 阅读 · 0 评论 -
POJ - 3254 - Corn Fields(dp & 状压)
POJ - 3254 - Corn Fields Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number...原创 2018-08-18 21:14:43 · 141 阅读 · 0 评论 -
HDU - 1087 - Super Jumping! Jumping! Jumping!(dp & 寻找价值最大的子串)
HDU - 1087 - 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 gam...原创 2018-08-16 15:45:01 · 267 阅读 · 0 评论 -
HDU - 1257 - 最少拦截系统(dp & 找子串)
HDU - 1257 - 最少拦截系统 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来...原创 2018-08-16 16:24:01 · 159 阅读 · 0 评论 -
POJ - 1458 - Common Subsequence(dp & 公共子串)
POJ - 1458 - 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 = ...原创 2018-08-16 16:53:58 · 161 阅读 · 0 评论 -
POJ - 2533 - Longest Ordered Subsequence (dp & 最长子串)
POJ - 2533 - Longest Ordered Subsequence POJ - 2533 - Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < … < aN. Let the subsequence of the given numeric sequence ...原创 2018-08-16 17:21:58 · 213 阅读 · 0 评论 -
HDU - 2546 - 饭卡(01背包)
HDU - 2546 - 饭卡 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 Input 多组数据...原创 2018-08-16 17:33:38 · 176 阅读 · 0 评论 -
HDU - 2602 - Bone Collector(01背包)
HDU - 2602 - Bone Collector Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to th...原创 2018-08-16 23:31:57 · 176 阅读 · 0 评论 -
POJ - 1276 - Cash Machine(多重背包)
POJ - 1276 - Cash Machine A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bi...原创 2018-08-17 00:12:49 · 301 阅读 · 0 评论 -
HDU-1087 - Super Jumping! Jumping! Jumping!(dp & 求子串)
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 c...原创 2018-08-28 13:55:44 · 123 阅读 · 0 评论 -
HDU 1003 - Max Sum(动态规划 & 找最大价值连续子串)
Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14. Input The fir...原创 2018-08-28 17:19:20 · 166 阅读 · 0 评论 -
CodeForces - 574D - Bear and Blocks(双向 dp )
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for t...原创 2018-09-19 10:24:44 · 242 阅读 · 0 评论 -
HDU - 5492 Find a path(dp)
Frog fell into a maze. This maze is a rectangle containing N rows and M columns. Each grid in this maze contains a number, which is called the magic value. Frog now stays at grid (1, 1), and he wants...原创 2019-09-10 09:48:53 · 164 阅读 · 0 评论