DP
_大太阳_
有梦想就去追
展开
-
light Oj 1071 - Baker Vai(记忆化搜索)
http://lightoj.com/volume_showproblem.php?problem=1071 1071 - Baker Vai PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB All原创 2016-04-19 12:45:27 · 532 阅读 · 0 评论 -
light oj 1017 - Brush (III) (dp)
http://lightoj.com/volume_showproblem.php?problem=1017 1017 - Brush (III) PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Samir原创 2015-12-13 17:59:25 · 414 阅读 · 0 评论 -
poj 1163 The Triangle (记忆化搜索)
http://poj.org/problem?id=1163 The Triangle Description 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates原创 2015-12-22 14:37:21 · 481 阅读 · 0 评论 -
poj 2955 Brackets (区间dp)||(记忆话搜素)
http://poj.org/problem?id=2955 Brackets Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4797 Accepted: 2550 Description We give the following in原创 2015-12-21 19:16:31 · 392 阅读 · 0 评论 -
poj 1088 滑雪 (记忆化搜索)
http://poj.org/problem?id=1088 滑雪 Description Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1原创 2015-12-04 12:56:38 · 404 阅读 · 0 评论 -
gdutcode 诺亚方舟 (dp)
http://gdutcode.sinaapp.com/problem.php?cid=1025&pid=6 诺亚方舟 Description “终有一天,耶和华的光会普照大地,旧的世界将会毁灭,新的世界将会产生。” ——《启示录·天启》 2096年11月8日,世界末日终于还是来临了。 而此时,世界上最后一个“神” —— sytrakl 也已经苏醒。原创 2015-12-04 10:28:52 · 659 阅读 · 0 评论 -
hdu 1052 Tian Ji -- The Horse Racing (贪心+dp)
http://acm.hdu.edu.cn/showproblem.php?pid=1052 Tian Ji -- The Horse Racing Problem Description Here is a famous story in Chinese history. "That was about 2300 years ago. General Tian Ji was原创 2016-01-17 17:15:46 · 465 阅读 · 0 评论 -
hdu 校赛 ACM组队安排 (递推)
http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1005&cid=638 ACM组队安排 Problem Description ACM亚洲区比赛结束,意味着开始备战明年的浙江省大学生程序设计竞赛了! 杭州电子科技大学ACM集训队也准备开始组队。 教练想把所有的n个队员组成若干支队伍,原则是每支队伍原创 2015-11-29 20:48:09 · 1278 阅读 · 0 评论 -
light oj 1033 - Generating Palindromes (区间dp)
http://lightoj.com/volume_showproblem.php?problem=1033 1033 - Generating Palindromes By definition palindrome is a string which is not changed when reversed. "MADAM" is a nice example of palindr原创 2015-12-30 13:13:52 · 512 阅读 · 0 评论 -
CodeForces 540D Bad Luck Island (概率dp)
http://codeforces.com/problemset/problem/540/D Bad Luck Island The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of原创 2015-11-20 17:43:50 · 565 阅读 · 0 评论 -
hdu 2859 Phalanx(字符匹配)
http://acm.hdu.edu.cn/showproblem.php?pid=2859 Phalanx Problem Description Today is army day, but the servicemen are busy with the phalanx for the celebration of the 60th anniversary of the原创 2015-11-03 15:29:32 · 421 阅读 · 0 评论 -
light Oj 1013 - Love Calculator (dp)
http://lightoj.com/volume_showproblem.php?problem=1013 1013 - Love Calculator Yes, you are developing a 'Love calculator'. The software would be quite complex such that nobody could crack the ex原创 2015-12-11 19:40:18 · 497 阅读 · 0 评论 -
light oj 1011 - Marriage Ceremonies (状压 dp)
http://lightoj.com/volume_showproblem.php?problem=1011 1011 - Marriage Ceremonies You work in a company which organizes marriages. Marriages are not that easy to be made, so, the job is quit原创 2015-12-11 13:45:03 · 602 阅读 · 0 评论 -
Light oj 1047 - Neighbor House (简单dp)
http://lightoj.com/volume_showproblem.php?problem=1047 1047 - Neighbor House PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB原创 2015-12-22 16:29:56 · 645 阅读 · 0 评论 -
lightoj Monkey Banana Problem (记忆化搜索)
http://lightoj.com/volume_showproblem.php?problem=1004 Monkey Banana Problem You are in the world of mathematics to solve the great "Monkey Banana Problem". It states that, a monkey原创 2015-12-04 16:04:53 · 491 阅读 · 0 评论 -
CodeForces 615B Longtail Hedgehog(dp)
http://codeforces.com/contest/615/problem/B n个点,m条无向边,在连成的链中找一条递增的链,使得末尾节点的度数乘以深度最大,因为是无向边,又要求递增的链,所以尽量使小的数做起点,并且将所有的边按照节点大小进行排序,从最小的点开始遍历,记录每一个点最大的深度,然后找到最大的乘积 注意:最后的乘积用long long #include #incl原创 2016-05-10 10:44:06 · 299 阅读 · 0 评论 -
poj 1015 Jury Compromise
http://poj.org/problem?id=1015 Jury Compromise Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 27117 Accepted: 7140 Special Judge Description In原创 2016-04-10 12:43:15 · 313 阅读 · 0 评论 -
hdu 1260 Tickets (dp)
http://acm.hdu.edu.cn/showproblem.php?pid=1260 Tickets Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2538 Accepted Submission(s): 1原创 2016-03-28 19:43:59 · 367 阅读 · 0 评论 -
hdu 2802 F(N)(递推)
http://acm.hdu.edu.cn/showproblem.php?pid=2802 F(N) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4378 Accepted Submission(s): 1523原创 2016-03-28 18:54:37 · 438 阅读 · 0 评论 -
hdu 5643 King's Game (dp约瑟夫环)
http://acm.hdu.edu.cn/showproblem.php?pid=5643 King's Game Problem Description In order to remember history, King plans to play losephus problem in the parade gap.He calls n(1≤n≤5000) soldi原创 2016-03-15 17:46:46 · 618 阅读 · 0 评论 -
hdu 1074 Doing Homework (状压 + 记录路径)
http://acm.hdu.edu.cn/showproblem.php?pid=1074 Doing Homework Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7316 Accepted Submission(原创 2016-04-03 16:34:04 · 356 阅读 · 0 评论 -
hdu 1024 Max Sum Plus Plus
http://acm.hdu.edu.cn/showproblem.php?pid=1024 Max Sum Plus Plus Problem Description Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge our原创 2015-10-27 20:39:03 · 267 阅读 · 0 评论 -
Light Oj 1044 - Palindrome Partitioning(回文串)
http://lightoj.com/volume_showproblem.php?problem=1044 1044 - Palindrome Partitioning A palindrome partition is the partitioning of a string such that each separate substring is a palindrome. F原创 2016-03-30 21:18:42 · 561 阅读 · 1 评论 -
CodeForces 106C Buns (01beoba)
http://codeforces.com/problemset/problem/540/B C. Buns time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard out原创 2016-03-06 14:18:43 · 640 阅读 · 0 评论 -
hdu 2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 (多重背包)
http://acm.hdu.edu.cn/showproblem.php?pid=2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 Problem Description 急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买原创 2015-11-04 16:36:54 · 332 阅读 · 0 评论 -
LightOJ 1005 - Rooks(DP)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=96545#overview 题目大意: 给你一个N和K要求确定有多少种放法,使得没有两个车在一条线上。 N*N的矩阵, 有K个棋子。 题目分析: 我是用DP来写的,关于子结构的考虑是这样的。 假设第n*n的矩阵放k个棋子那么,这个推导过程如下。 当我们们第n原创 2015-10-25 11:30:46 · 576 阅读 · 0 评论 -
hdu 2126 Buy the souvenirs (01背包输出方案数)
http://acm.hdu.edu.cn/showproblem.php?pid=2126 Buy the souvenirs Problem Description When the winter holiday comes, a lot of people will have a trip. Generally, there are a lot of souvenirs to se原创 2015-12-07 17:33:04 · 393 阅读 · 0 评论 -
背包问题九讲
01背包问题描述 已知:有一个容量为V的背包和N件物品,第i件物品的重量是weight[i],收益是cost[i]。 限制:每种物品只有一件,可以选择放或者不放 问题:在不超过背包容量的情况下,最多能获得多少价值或收益 相似问题:在恰好装满背包的情况下,最多能获得多少价值或收益 这里,我们先讨论在不超过背包容量的情况下,最多能获得多少价值或收益。 基本思路原创 2015-11-18 16:13:39 · 372 阅读 · 0 评论 -
hdu 1078 FatMouse and Cheese (记忆化搜索)
http://acm.hdu.edu.cn/showproblem.php?pid=1078 FatMouse and Cheese Problem Description FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n:原创 2015-11-02 16:47:26 · 295 阅读 · 0 评论 -
zznu 1304: 防御导弹
http://acm.zznu.edu.cn/problem.php?id=1304 1304: 防御导弹 题目描述 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。但是这种导弹拦截 系统有一个缺陷:虽然它的第一发炮弹能够达到任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国的导弹来袭。由于该系统还在试 用阶段,所以只有一套系统,因此有可能原创 2015-10-24 10:48:47 · 778 阅读 · 0 评论 -
hdu 2844 Coins(多重背包)
http://acm.hdu.edu.cn/showproblem.php?pid=2844 Coins Problem Description Whuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found t原创 2015-11-06 16:52:06 · 261 阅读 · 0 评论 -
hdu 1171 Big Event in HDU (01背包)
http://acm.hdu.edu.cn/showproblem.php?pid=1171 Big Event in HDU Problem Description Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know t原创 2015-11-07 12:47:19 · 272 阅读 · 0 评论 -
hdu 2955 Robberies(01背包)
http://acm.hdu.edu.cn/showproblem.php?pid=2955 Robberies Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught i原创 2015-11-07 13:55:00 · 246 阅读 · 0 评论 -
hdu 1712 ACboy needs your help (分组背包)
http://acm.hdu.edu.cn/showproblem.php?pid=1712 ACboy needs your help Problem Description ACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he原创 2015-11-05 18:19:34 · 259 阅读 · 0 评论 -
poj 1661 Help Jimmy
http://poj.org/problem?id=1661 Help Jimmy Description "Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度无限。 Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当Jimmy落到某个平台上时,原创 2015-11-03 19:37:50 · 278 阅读 · 0 评论 -
poj 3080 Blue Jeans
http://poj.org/problem?id=3080 Blue Jeans Description The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds o原创 2015-10-01 10:21:48 · 318 阅读 · 0 评论 -
最长上升子序列 (二分)
先回顾经典的O(n^2)的动态规划算法,设A[t]表示序列中的第t个数,F[t]表示从1到t这一段中以t结尾的最长上升子序列的长度,初始时设F[t] = 0(t = 1, 2, ..., len(A))。则有动态规划方程:F[t] = max{1, F[j] + 1} (j = 1, 2, ..., t - 1, 且A[j] 根据F[]的值进行分类。对于F[]的每一个取值k,我们只转载 2015-09-27 16:33:04 · 382 阅读 · 0 评论 -
hdu 免费馅饼 (dp)
http://acm.hdu.edu.cn/showproblem.php?pid=1176 免费馅饼 Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马原创 2015-09-03 10:06:44 · 356 阅读 · 0 评论 -
UVA 624 CD (DP)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87813#problem/G CD Description You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is o原创 2015-08-15 08:36:41 · 276 阅读 · 0 评论 -
hdu 1069 Monkey and Banana
http://acm.hdu.edu.cn/showproblem.php?pid=1069 Monkey and Banana Problem Description A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a bana原创 2015-08-14 20:10:13 · 325 阅读 · 0 评论