动态规划
admin__
这个作者很懒,什么都没留下…
展开
-
数组的最大代价
题目:数组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 21:11:40 · 93 阅读 · 0 评论 -
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 bill denominations, say ...原创 2019-03-15 17:54:10 · 113 阅读 · 0 评论 -
Anniversary party
题目: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...原创 2018-08-26 21:23:50 · 126 阅读 · 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 th...原创 2018-08-19 21:40:06 · 170 阅读 · 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 ...原创 2018-08-26 19:55:41 · 227 阅读 · 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 pa...原创 2018-08-06 20:43:07 · 120 阅读 · 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 s...原创 2018-08-05 21:36:09 · 109 阅读 · 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 seq...原创 2018-08-05 21:30:17 · 233 阅读 · 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 nu...原创 2018-08-05 21:20:23 · 142 阅读 · 0 评论 -
搬寝室
题目:搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手的物品的重量差的平方成正比...原创 2018-08-05 20:54:22 · 139 阅读 · 0 评论 -
饭卡
题目:电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 Input多组数据。对于每组数据: 第一行...原创 2018-08-05 20:44:58 · 252 阅读 · 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 p...原创 2018-08-02 21:10:06 · 130 阅读 · 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...原创 2018-08-02 20:54:33 · 754 阅读 · 0 评论 -
悼念512汶川大地震遇难同胞——珍惜现在,感恩生活
题目:急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢? 后记: 人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。 月有阴晴圆缺,人有旦夕祸福,未来对于我们而言是一...原创 2018-07-29 21:47:42 · 164 阅读 · 0 评论 -
棋盘分割
题目:将一个8*8的棋盘进行如下分割:将原棋盘割下一块矩形棋盘并使剩下部分也是矩形,再将剩下的部分继续如此分割,这样割了(n-1)次后,连同最后剩下的矩形棋盘共有n块矩形棋盘。(每次切割都只能沿着棋盘格子的边进行) 原棋盘上每一格有一个分值,一块矩形棋盘的总分为其所含各格分值之和。现在需要把棋盘按上述规则分割成n块矩形棋盘,并使各矩形棋盘总分的均方差最小。 均方差 ,其中平均值 ,...原创 2018-07-29 21:38:42 · 112 阅读 · 0 评论 -
Maximum Sum
题目:题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=44 大意:在给出的矩阵当中,找出一个子矩形矩阵可以使得里面加起来的值是所有子矩阵中最大的。 思路: 将...原创 2018-07-22 21:03:32 · 115 阅读 · 0 评论 -
Filthy Rich
题目:They say that in Phrygia, the streets are paved with gold. You’re currently on vacation in Phrygia, and to your astonishment you discover that this is to be taken literally: small heaps of gold a...原创 2018-07-18 21:19:11 · 175 阅读 · 0 评论 -
The contest———CSU - 1326(分组背包、并查集)
题目: 殷犇有很多队员。他们都认为自己是最强的,于是,一场比赛开始了~ 于是安叔主办了一场比赛,比赛有n个题目,每个题目都有一个价值Pi和相对能力消耗Wi,但是有些题目因为太坑不能同时做出来,并且坑题具有传递性。(a和b一起做会坑、b和c会坑则a和c也会坑) ACM队员们想知道,于是他们想知道在能力范围内,它们最多可以作出多少价值的题目。 聪明的你,告诉我,能帮帮他们吗?In...原创 2019-04-24 19:54:57 · 107 阅读 · 0 评论