动态规划
文章平均质量分 77
Cworld2017
这个作者很懒,什么都没留下…
展开
-
Maximum sum 二维最大子段和
Given a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below:Your task is to calculate d(A).InputThe input consists of T(<=30) test cases. The number of test cases (T) ...原创 2017-11-22 21:39:08 · 480 阅读 · 0 评论 -
P - Pascal's Travels HDU - 1208
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-02-28 23:20:35 · 134 阅读 · 0 评论 -
J - Employment Planning
点击打开链接https://cn.vjudge.net/problem/30427/origin题意;一个公司每个月都要至少num人,现在有n个月,工资,开除,雇佣都需要花钱,现在求花费最小。分析:dp[i][j]表示第i+1个月j个人工作时的最小费用。这个月L个人去枚举上个月人数的各种情况,并且两个月之间由于人数的差距需要分情况讨论是雇佣还是开除人#include<stdio.h>...原创 2018-02-24 15:53:52 · 143 阅读 · 0 评论 -
Q - 最少拦截系统 HDU - 1257
某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹. 怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计算一下最少需要多少套拦截系统....原创 2018-03-03 15:29:33 · 164 阅读 · 0 评论 -
V - Distribute Message HDU - 1723
The contest’s message distribution is a big thing in prepare. Assuming N students stand in a row, from the row-head start transmit message, each person can transmit message to behind M personals, and ...原创 2018-03-03 22:43:50 · 204 阅读 · 0 评论 -
U - Function Run Fun HDU - 1579
We all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a <= 0 or b <= 0 or c <= 0, then w(a, b, c) returns: 1 if a > 20 or b > 20 or c > 20, ...原创 2018-03-04 14:19:46 · 147 阅读 · 0 评论 -
N - 龟兔赛跑 HDU - 2059
据说在很久很久以前,可怜的兔子经历了人生中最大的打击——赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。 最近正值HDU举办50周年校庆,社会各大名流齐聚下沙,兔子也趁此机会向乌龟发起挑战。虽然乌龟深知获胜希望不大,不过迫于舆论压力,只能接受挑战。 ...原创 2018-05-07 22:11:40 · 154 阅读 · 0 评论 -
Doing Homework
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after th...转载 2018-08-03 22:31:50 · 352 阅读 · 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 gam...原创 2018-08-03 23:10:46 · 464 阅读 · 0 评论 -
Treats for the Cows 区间dp
FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per day and wants to maximize the money he receives over a given p...转载 2018-08-04 20:59:06 · 149 阅读 · 0 评论 -
E - Monkey and Banana HDU - 1069
A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monk...原创 2018-02-20 11:07:54 · 256 阅读 · 0 评论 -
N - 免费馅饼 H
都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝...原创 2018-02-26 22:45:41 · 143 阅读 · 0 评论 -
G - To the Max POJ - 1050 最大子矩阵和
Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the sum of原创 2017-11-27 22:15:48 · 247 阅读 · 0 评论 -
H - Post Office POJ - 1160
There is a straight highway with villages alongside the highway. The highway is represented as an integer axis, and the position of each village is identified with a single integer coordinate. There a原创 2017-12-27 20:54:25 · 313 阅读 · 0 评论 -
L - Mondriaan's Dream POJ - 2411
出处:http://blog.csdn.net/Waves___/article/details/74165341题意:给你一个h*w的矩形,问用1*2的小矩形覆盖有多少种方法/*题目链接:https://vjudge.net/problem/POJ-2411 参考:http://www.cnblogs.com/scau20110726/archive/2013/03/14/29604转载 2018-01-31 14:07:47 · 226 阅读 · 0 评论 -
B - Multiplication Puzzle POJ - 1651
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points equal to the pr转载 2018-01-25 12:04:32 · 331 阅读 · 0 评论 -
E - Longest Ordered Subsequence POJ - 2533
A numeric sequence of ai is ordered ifa1 a2 < ... <aN. Let the subsequence of the given numeric sequence (a1, a2, ...,aN) be any sequence ( ai1,ai2, ..., aiK), where 1 i1 <i2 iK <=N. F原创 2018-01-26 11:27:57 · 178 阅读 · 0 评论 -
I - Human Gene Functions POJ - 1080
题目链接:https://cn.vjudge.net/problem/15304/origin题目大意:给出两个字符串,要使他们对齐,比如:AGTGATGGTTAG这两个字符串可以看成是AGTGATG-GTTA-G也可以看成是AGTGAT-G-GT--TAG然后每个对齐的字母去查表可以得到他们的值问怎么对齐可以得到所有值的和的最大值解题思路,这是转载 2018-01-27 11:33:09 · 169 阅读 · 0 评论 -
J - Palindrome POJ - 1159
https://cn.vjudge.net/problem/15305/origin#include #include #include #include using namespace std;short dp[5001][5001];char s1[5001],s2[5001];int main(){ int n; while(cin>>n){ g转载 2018-01-27 16:27:05 · 166 阅读 · 0 评论 -
A - Max Sum HDU - 1003
要找出和最大的子段,首先想到的是枚举,枚举的方法是,分别将数串中的每一个数作为子段的第一位数,然后子段长度依次递增。例如:(2,-3,4,-1)这个数串枚举的所有情况为:以2作为子段的第一位: 2,(2,-3),(2,-3,4),(2,-3,4,-1)。以-3作为子段的第一位: -3,(-3,4),(-3,4,-1)。以4作为子段的第一位: 4,(原创 2018-02-06 17:42:00 · 184 阅读 · 0 评论 -
O - I NEED A OFFER! HDU - 1203
Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估计了他得到这个学校offer的可能性b。不同学校之...原创 2018-02-26 22:37:06 · 214 阅读 · 0 评论 -
Count 101
You know YaoYao is fond of his chains. He has a lot of chains and each chain has n diamonds on it. There are two kinds of diamonds, labeled 0 and 1. We can write down the label of diamonds on a chain....原创 2018-08-16 15:14:31 · 239 阅读 · 0 评论