![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
荣不翻身的咸鱼
这个作者很懒,什么都没留下…
展开
-
Filthy Rich
题目大意: 输入第一行两个整数表示下面那个矩阵的行数和列数,第二行开始输入一个矩阵。从左上角到右下角,只能向下或者向右走,输出所经过的数字和最大。Sample Input13 41 10 8 80 0 1 80 27 0 4Sample OutputScenario #1:42#include<iostream>#include&l...原创 2018-07-18 21:06:24 · 185 阅读 · 0 评论 -
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-26 13:49:47 · 82 阅读 · 0 评论 -
Two Strings Swaps
You are given two strings aa and bb consisting of lowercase English letters, both of length nn. The characters of both strings have indices from 11 to nn, inclusive.You are allowed to do the followi...原创 2018-08-02 18:57:29 · 92 阅读 · 0 评论 -
Bridging signals
'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-08-02 14:53:10 · 94 阅读 · 0 评论 -
Palindrome
A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal numb...原创 2018-08-02 14:49:09 · 145 阅读 · 0 评论 -
Cheapest Palindrome
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...原创 2018-08-05 19:29:04 · 84 阅读 · 0 评论 -
数组的最大代价
数组A包含N个元素A1, A2......AN。数组B包含N个元素B1, B2......BN。并且数组A中的每一个元素Ai,都满足1 <= Ai <= Bi。数组A的代价定义如下: (公式表示所有两个相邻元素的差的绝对值之和)给出数组B,计算可能的最大代价S。Input第1行:1个数N,表示数组的长度(1 <= N <= 50000)。 第...原创 2018-08-09 19:12:10 · 103 阅读 · 0 评论 -
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-05 14:14:30 · 77 阅读 · 0 评论 -
Greatest Common Increasing Subsequence
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 <= M <= 500) and M integer numbers...原创 2018-08-05 14:13:29 · 88 阅读 · 0 评论 -
Largest Rectangle in a Histogram
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 ...原创 2018-08-05 14:12:31 · 98 阅读 · 0 评论 -
搬寝室
搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手的物品的重量差的平方成正比(这里补充...原创 2018-08-05 14:11:26 · 101 阅读 · 0 评论 -
饭卡
电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 Input多组数据。对于每组数据: 第一行为正整数n...原创 2018-08-05 14:10:32 · 133 阅读 · 0 评论 -
Free Candies
Little Bob is playing a game. He wants to win some candies in it - as many as possible. There are 4 piles, each pile contains N candies. Bob is given a basket which can hold at most 5 candies...原创 2018-07-29 16:48:08 · 93 阅读 · 0 评论 -
How many ways
这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m)。游戏的规则描述如下: 1.机器人一开始在棋盘的起始点并有起始点所标有的能量。 2.机器人只能向右或者向下走,并且每走一步消耗一单位能量。 3.机器人不能在原地停留。 4.当机器人选择了一条可行路径后,当他走到这条路径的终点时,他将只有终点所标记的能量。如上图,机器人一开始在(1,1)点,...原创 2018-07-29 15:39:35 · 95 阅读 · 0 评论 -
棋盘分割
将一个8*8的棋盘进行如下分割:将原棋盘割下一块矩形棋盘并使剩下部分也是矩形,再将剩下的部分继续如此分割,这样割了(n-1)次后,连同最后剩下的矩形棋盘共有n块矩形棋盘。(每次切割都只能沿着棋盘格子的边进行) 原棋盘上每一格有一个分值,一块矩形棋盘的总分为其所含各格分值之和。现在需要把棋盘按上述规则分割成n块矩形棋盘,并使各矩形棋盘总分的均方差最小。 均方差 ,其中平均值 ,x i为第...原创 2018-07-28 20:43:57 · 117 阅读 · 0 评论 -
悼念512汶川大地震遇难同胞——珍惜现在,感恩生活
急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢? 后记: 人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。 月有阴晴圆缺,人有旦夕祸福,未来对于我们而言是一个未知数。...原创 2018-07-28 20:34:46 · 78 阅读 · 0 评论 -
滑雪
Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 1...原创 2018-07-28 20:33:31 · 134 阅读 · 0 评论 -
Functions again
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arr...原创 2018-08-19 16:02:10 · 96 阅读 · 0 评论