dp
文章平均质量分 53
slldew
这个作者很懒,什么都没留下…
展开
-
Pascal's Travels
An n x n game board is populated with integers, one nonnegative integer per square. The goal is to travel along any legitimate path from the upper left corner to the lower right corner of the board. T...原创 2018-07-29 21:04:05 · 252 阅读 · 0 评论 -
饭卡
电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 Input多组数据。对于每组数据: 第一行为正整数n...原创 2018-08-05 14:20:17 · 265 阅读 · 0 评论 -
搬寝室
搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手的物品的重量差的平方成正比(这里补充...原创 2018-08-05 14:54:46 · 86 阅读 · 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 19:30:55 · 224 阅读 · 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 20:51:33 · 87 阅读 · 0 评论