
动态规划
文章平均质量分 86
elkluh
简单,容易,一看就会。
展开
-
Piggy-Bank HDU - 1114
F - Piggy-Bank HDU - 1114 Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Mone原创 2018-01-23 14:57:06 · 272 阅读 · 0 评论 -
F - Lighting System Design UVA - 11400
F - Lighting System Design UVA - 11400 1.首先得到一个结论,每种电压的灯泡要么全换,要么全不换。如果只换部分灯泡,则不能节省电源的费用。2.把灯泡按从小到大的顺序排。设s【i】为前i种灯泡的总数量 //我开始忘记排序了老是WA3.d【i】为第1-i种灯泡的最小开销。状态转移方程d【i】=min{d[i],d[j]+(s[i]-s原创 2018-01-20 10:24:11 · 257 阅读 · 0 评论 -
E - Jin Ge Jin Qu hao UVA - 12563
E - Jin Ge Jin Qu hao UVA - 12563 这道题的解法就是背包问题的解法但是这道题的不同之处在于它有三个条件。1.要保证能唱的歌的数量最多。2.要保证在唱的歌的数量最多的前提下唱的时间最晚。3.要保证一定要唱劲歌金曲这首歌。开始的时候我在想要怎样唱才能保证一定有时间唱劲歌金曲,后来看了一下题目,它的意思是,你只要开始唱了一首歌,那么服务员就不会让你停下来。而你一定要唱这首原创 2018-01-19 15:27:13 · 297 阅读 · 0 评论 -
CodeForces - 839B Game of the Rows
B. Game of the Rowstime limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputDaenerys Targaryen has an army consisting of k groups of soldiers, the i-th原创 2017-11-14 20:52:27 · 209 阅读 · 0 评论 -
Common Subsequence POJ - 1458
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly incr原创 2018-01-26 10:20:24 · 208 阅读 · 0 评论 -
C - Tour UVA - 1347
C - Tour - 1347 John Doe, a skilled pilot, enjoys traveling. While on vacation, he rents a small plane and starts visitingbeautiful places. To save money, John must determine the shortest closed tour原创 2018-01-17 19:38:16 · 295 阅读 · 0 评论 -
FatMouse's Speed HDU - 1160
FatMouse's Speed 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 t原创 2018-01-25 11:40:14 · 218 阅读 · 0 评论 -
最少拦截系统 HDU - 1257
最少拦截系统 HDU - 1257 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所原创 2018-01-24 17:12:34 · 270 阅读 · 0 评论 -
B - The Tower of Babylon UVA - 437
首先你知道这道题的题意是,在每个立方体的长和宽由上到下依次递减的情况下,求最大高度的问题。1.一个立方体的长宽高可以有六种形式。2.一个立方体可以用六种状态来储存。3.每种状态的值就是它的高。4.d(i)表示第i种状态它的高。5.如果有x种立方体,那么就有6*x种状态,那么把这些状态排序 把长和宽大的放在前面 小的放在后面,从最大的长宽开始遍历,那么dp[i]=max[dp[i原创 2018-01-16 10:24:57 · 251 阅读 · 0 评论 -
Tickets HDU - 1260
H - Tickets HDU - 1260 Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when原创 2018-01-24 10:17:57 · 282 阅读 · 0 评论 -
G - 免费馅饼 HDU - 1176
G - 免费馅饼 HDU - 1176 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏原创 2018-01-23 19:23:15 · 272 阅读 · 0 评论 -
A - A Spy in the Metro UVA - 1025
#include #include#includeusing namespace std;int INF=0x3f3f3f3f;int main(){ //freopen("E:\\file.txt","r",stdin); int has_train[205][55][2]; int N; //the number of stations int T原创 2018-01-16 09:34:40 · 235 阅读 · 0 评论