动态规划
文章平均质量分 70
Code_Diary
人生是修炼的过程
展开
-
HDU 1176动态规划
都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝原创 2017-07-07 22:35:28 · 275 阅读 · 0 评论 -
HDU-1025
JGShining’s kingdom consists of 2n(n is no more than 500,000) small cities which are located in two parallel lines. Half of these cities are rich in resource (we call them rich cities) while the others原创 2017-07-19 21:03:43 · 331 阅读 · 0 评论 -
POJ 1837
Gigel has a strange “balance” and he wants to poise it. Actually, the device is different from any other ordinary balance. It orders two arms of negligible weight and each arm’s length is 15. Some ho原创 2017-07-19 10:49:25 · 281 阅读 · 0 评论 -
POJ 2392
The cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 <= K <= 400) different types of blocks with which to build the towe原创 2017-07-19 10:00:11 · 470 阅读 · 0 评论 -
POJ 3211
Dearboy was so busy recently that now he has piles of clothes to wash. Luckily, he has a beautiful and hard-working girlfriend to help him. The clothes are in varieties of colors but each piece of them原创 2017-07-18 20:45:26 · 511 阅读 · 0 评论 -
HDU1059 && POJ1014
Marsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the marbles had the same va原创 2017-07-18 21:58:15 · 277 阅读 · 0 评论 -
HDU 1963 && POJ 2063
John never knew he had a grand-uncle, until he received the notary’s letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and that John was the only inh原创 2017-07-18 21:06:01 · 279 阅读 · 0 评论 -
POJ 3624
Bessie has gone to the mall’s jewelry store and spies a charm bracelet. Of course, she’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the s原创 2017-07-18 20:07:07 · 464 阅读 · 0 评论 -
HDU 4512
吉哥这几天对队形比较感兴趣。 有一天,有n个人按顺序站在他的面前,他们的身高分别是h11, h22 … hnn,吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则称之为完美队形: 1、挑出的人保持他们在原队形的相对顺序不变; 2、左右对称,假设有m个人形成新的队形,则第1个人和第m个人身高相同,第2个人和第m-1个人身高相同,依此类推,当原创 2017-07-18 20:01:43 · 315 阅读 · 0 评论 -
HDU 2844&& POJ 1742
Whuacmers use coins.They have coins of value A1,A2,A3…An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in a nearby shop. He wanted t原创 2017-07-16 20:49:31 · 332 阅读 · 0 评论 -
HDU 2191
急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢? 后记: 人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。 月有阴晴圆缺,人有旦夕祸福,未来对于我们而言是一个未知原创 2017-07-16 20:15:07 · 213 阅读 · 0 评论 -
HDU 1203
Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估计了他得到这个学校offer的可能性b。不同学校之间原创 2017-07-16 17:53:43 · 266 阅读 · 0 评论 -
HDU 1421
搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手的物品的重量差的平方成正比(这里补充一原创 2017-07-16 17:43:39 · 251 阅读 · 0 评论 -
HDU 1160
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原创 2017-07-16 16:44:11 · 311 阅读 · 0 评论 -
HDU1024
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 a原创 2017-07-15 17:01:21 · 361 阅读 · 0 评论 -
HDU1087
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原创 2017-07-15 14:52:42 · 366 阅读 · 0 评论 -
DP
动态规划 ①符合无后效性:不管之前的这个状态是如何的到的(之前计算的最优不会因为后面的数据而没用) ②最优子结构:每个阶段的最优状态可以从之前的某个阶段的某个或某些状态直接得到 设计步骤: 一、分析子问题 二、做表 自己总结的,不供参考 类型: 数塔 http://acm.hdu.edu.cn/showproblem.php?pid=2084#include#inclu原创 2017-07-16 19:51:37 · 291 阅读 · 0 评论