
DP
文章平均质量分 82
Algobird
这个作者很懒,什么都没留下…
展开
-
hdu2084 数塔
数塔Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24517 Accepted Submission(s): 14752Problem Description在讲述DP算法的时候,一个经典的例子就是数原创 2015-01-26 20:53:41 · 438 阅读 · 0 评论 -
整数划分系列问题(动态规划)
今天上算法分析与设计课时,提到整数划分问题,但是因为之前没有很好地理解这一系列的问题。当被老师问到你们做算法的应该会这个问题吧,我当时也不太记得,但是只能硬头皮试着去写了下,用的是brute force,老师果断说我的方法跑不出正确的解,但是课堂上我也没有去解释了。课后自己验证了一下,没有问题,但是看了一下更好的动态规划的解法,顺便把几种整数划分的类型都理解清楚。原题:一个整数划分为多原创 2015-09-15 17:45:42 · 1134 阅读 · 0 评论 -
POJ 2068 Nim(博弈+dp)
题目链接:http://poj.org/problem?id=2068两个队伍,每队n人, 一堆石子s个,两队轮流拿,n个数,奇数位是1队,偶数位是2队,数值表示这名选手最多可以拿多少个。然后选手按照顺序交替取石子,求是否必胜。题目本身不难,关键能不能想到dp[i][j]去表示轮到第i个人拿的时候,有j个石子。参考了一下大神的博客,才知道这题是dp,看到dp数组就自己可以打了,看来做博原创 2015-08-21 09:35:46 · 533 阅读 · 0 评论 -
codeforces #546D# Soldier and Number Game(Dp,素数打表)
题目链接:http://codeforces.com/contest/546/problem/DTwo soldiers are playing a game. At the beginning first of them chooses a positive integern and gives it to the second soldier. Then the secon原创 2015-05-26 01:25:12 · 579 阅读 · 0 评论 -
hdu 1160 FatMouse's Speed(最大上升子序列dp)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160最大上升子序列的裸题,从给定样例中找到严格满足老鼠体重和速度成反比的尽量多的案例。先按照体重排序,然后在用dp求最大上升子序列(体重是降序排列的),求的时候要注意体重是严格单调的判断。代码:#include using namespace std;struct no原创 2015-06-23 19:33:42 · 454 阅读 · 0 评论 -
CodeForces #505C# Mr. Kitayuta, the Treasure Hunter(dp数组定义)
DescriptionThe Shuseki Islands are an archipelago of 30001 small islands in the Yutampo Sea. The islands are evenly spaced along a line, numbered from0 to 30000 from the west to the east. Th原创 2015-02-13 20:41:27 · 532 阅读 · 0 评论 -
HDU 2059 龟兔赛跑(dp)
Description据说在很久很久以前,可怜的兔子经历了人生中最大的打击――赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。最近正值HDU举办50周年校庆,社会各大名流齐聚下沙,兔子也趁此机会向乌龟发起挑战。虽然乌龟深知获胜希望原创 2015-02-13 21:31:45 · 650 阅读 · 0 评论 -
uva 103 Stacking Boxes(LIS)
Stacking Boxes BackgroundSome concepts in Mathematics and Computer Science are simple in one or two dimensions but become more complex when extended to arbitrary dimensions. Consider s原创 2015-02-01 11:29:11 · 391 阅读 · 0 评论 -
hdu1003 Max Sum(dp或分治)
解题报告:原创 2015-01-11 11:01:33 · 927 阅读 · 0 评论 -
POJ 1631 Bridging signals(LIS)
Bridging signalsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11034 Accepted: 6047Description'Oh no, they've done it again', cries the chief designe原创 2015-01-28 21:29:37 · 468 阅读 · 0 评论 -
用O(nlogn)的算法实现最大上升子序列(LIS)输出.
一直在考虑能不能用O(nlogn)的贪心能否输出子序列,参考了别人的blog,自己分析了一下,整理了这样一篇文章。首先我们要知道在LIS贪心算法中,dp[i]数组表示的是长度为i的子序列的可取最小末尾是dp[i],所以直接输出的dp[i]数组得到的并不是最大上升子序列。详见:http://blog.youkuaiyun.com/yorkcai/article/details/8651895原创 2015-02-01 14:47:11 · 589 阅读 · 0 评论 -
POJ 2533 Longest Ordered Subsequence
Longest Ordered SubsequenceTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 35275 Accepted: 15481DescriptionA numeric sequence of ai is ordered if a1 a原创 2015-01-27 21:46:28 · 438 阅读 · 0 评论 -
UVA10405 Longest Common Subsequence
A - Longest Common SubsequenceTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit Status Practice UVA 10405DescriptionProblem C: Longest Common Subsequ原创 2015-01-26 21:30:42 · 595 阅读 · 0 评论 -
HDU 5459 Jesus Is Here(斐波那契递推 取模)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5459比赛的时候把每个c的位置的到下一个c位置的距离算出来,想着怎么去求和,结果卡死在上面了。然后后来就一直在想出题者和cff的关系了。。。赛后仔细琢磨了一下,觉得这种题就应该从递推的角度去分析,1A.首先定义dp[i]表示整数i对应的答案,那么就会有dp[i] = dp[i-2] + dp原创 2015-09-19 21:08:34 · 1649 阅读 · 0 评论