动态规划
文章平均质量分 82
say_c_box
小白不能不努力~
展开
-
POJ 1821--Fence(单调队列优化dp,总结一下)
FenceTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 5185 Accepted: 1643DescriptionA team of k (1 <= K <= 100) workers should paint a fence which contai原创 2017-10-10 19:53:13 · 600 阅读 · 0 评论 -
codeforce Gym100269F——Flight Boarding Optimization(动态规划)
题目传送门:http://codeforces.com/gym/100269/attachments/download/1978/20132014-acmicpc-neerc-nothern-subregional-contest-en.pdfdp[i][j]表示i为最后一个分段的结尾,一共分了j端。详细的解释可以看这篇博客,想到预处理正序对就很简单了。http://blog.原创 2017-05-10 19:59:18 · 504 阅读 · 0 评论 -
UVALive 3942 - Remember the Word(DP,字典树)
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1943白书P209// test.cpp : 定义控制台应用程序的入口点。//#define _CRT_SECURE_NO_WARNINGS#include原创 2017-03-14 21:53:54 · 361 阅读 · 0 评论 -
codeforces 788A——Functions again(动态规划)
A. Functions againtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSomething happened in Uzhlyandia again...原创 2017-03-30 20:12:05 · 1056 阅读 · 0 评论 -
HDU4345————Permutation(置换群,dp)
PermutationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 910 Accepted Submission(s): 536Problem DescriptionThere is an arra原创 2017-03-23 11:09:26 · 334 阅读 · 0 评论 -
codeforces621E————Wet Shark and Blocks(动态规划,矩阵快速幂)
E. Wet Shark and Blockstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are b blocks of digits. Each原创 2017-02-26 21:05:36 · 360 阅读 · 0 评论 -
POJ1692————Crossed Matchings(动态规划)
There are two rows of positive integer numbers. We can draw one line segment between any two equal numbers, with values r, if one of them is located in the first row and the other one is located in th原创 2017-02-26 14:59:03 · 416 阅读 · 0 评论 -
UESTC878————温泉旅店(动态规划)
温泉旅店Time Limit: 3000/1000MS (Java/Others) Memory Limit: 262143/262143KB (Java/Others)Submit Status天空飘下一朵一朵的雪花,这是一片纯白的世界。在天空之下的温泉旅店里,雪菜已醉倒在一旁,冬马与春希看了看说着梦话的雪菜,决定找一点玩的来度过这愉快的晚原创 2017-02-26 14:15:16 · 639 阅读 · 0 评论 -
POJ1037————A decorative fence(动态规划)
A decorative fenceTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7545 Accepted: 2869DescriptionRichard just finished building his new house. Now the原创 2017-03-04 10:43:29 · 1483 阅读 · 0 评论 -
Gym - 101116K ——Mixing Bowls(树形dp)
原题:https://odzkskevi.qnssl.com/efe310c5868f7c1881a7cec2c6b3e9cc?v=1487513501You are following a recipe to create your lunch.The recipe is a mixture made by combining ingredients togetherin a bow原创 2017-02-27 21:26:30 · 319 阅读 · 0 评论 -
Codeforces Round #383 (Div. 2)全部题解 (A,B,C,D,E)
A. Arpa’s hard exam and Mehrdad’s naive cheattime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere exists a原创 2016-12-07 19:09:15 · 1640 阅读 · 0 评论 -
HDU2089——不要62(数位dp入门)
不要62Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 35612 Accepted Submission(s): 12972Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音原创 2016-10-03 17:50:34 · 349 阅读 · 0 评论 -
HDU3555——Bomb(数位dp入门)
BombTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 15805 Accepted Submission(s): 5761Problem DescriptionThe counter-terrori原创 2016-10-02 18:36:35 · 420 阅读 · 1 评论 -
HDU4800——Josephina and RPG(概率dp)
Josephina and RPGTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1538 Accepted Submission(s): 467Special JudgeProblem Description原创 2016-10-15 11:06:29 · 358 阅读 · 0 评论 -
codeforcodeforces 808E——Selling Souvenirs(动态规划)官方题解详解
E. Selling Souvenirstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter several latest reforms many tour原创 2017-05-16 08:46:52 · 1766 阅读 · 1 评论 -
codeforces811C——Vladik and Memorable Trip(动态规划)
C. Vladik and Memorable Triptime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVladik often travels by trains原创 2017-05-28 13:00:50 · 1812 阅读 · 0 评论 -
HDU1024 ——Max Sum Plus Plus(动态规划)
Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28869 Accepted Submission(s): 10125Problem DescriptionNow I原创 2017-05-28 16:01:40 · 380 阅读 · 0 评论 -
HDU3401 Trade (动态规划+单调队列)
/*知道之后n天的股票买卖价格(api,bpi),以及每天股票买卖数量上限(asi,bsi),问他最多能赚多少钱。开始时有无限本金,要求任两次交易需要间隔W天以上,即第i天交易,第i+w+1天才能再交易。同时他任意时刻最多只能拥有maxp的股票,容易写出DP方程 dp[i][j]=max{dp[i-1][j],max{dp[r][k]-APi[i]*(j-k)}(0j)} 分别是第i天不交易原创 2017-09-07 21:13:25 · 466 阅读 · 0 评论 -
HDU5492 Find a path (动态规划)
Find a pathTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1866 Accepted Submission(s): 809Problem DescriptionFrog fell into原创 2017-08-29 19:16:46 · 276 阅读 · 0 评论 -
HDU6078 Wavel Sequence(动态规划)
Wavel SequenceTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 728 Accepted Submission(s): 377Problem DescriptionHave you ev原创 2017-08-28 19:28:22 · 368 阅读 · 0 评论 -
HDU6035 Colorful Tree(树形dp)
Colorful TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1152 Accepted Submission(s): 463Problem DescriptionThere is a原创 2017-07-26 17:21:41 · 1682 阅读 · 0 评论 -
E. Karen and Supermarket(树形dp)
E. Karen and Supermarkettime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputOn the way home, Karen decided to原创 2017-07-25 10:30:32 · 493 阅读 · 0 评论 -
HDU4917 Permutation(状态压缩dp,图论)
PermutationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 896 Accepted Submission(s): 281Problem Descriptionbobo has a per原创 2017-07-24 09:23:19 · 517 阅读 · 0 评论 -
codeforces Gym - 101190F——Foreign Postcards(动态规划)
http://codeforces.com/gym/101190/attachments题目大意:有n张卡片,每一张卡片有一个初始摆放方式,w代表错误方式,c代表正确方式。每次随意选出最上方的k张卡片,观察第一张,如果第一张错误摆放,则将这k张全部翻转,这k张就不再管了,知道卡片堆为空为止。问最后错误摆放的牌的个数的期望。 题解:我们从后往前考虑,dp[i]表示剩余卡片为i-n的情况下,考虑怎么转原创 2017-07-23 22:31:29 · 879 阅读 · 0 评论 -
HDU1074——Doing Homework(状态压缩dp)
Doing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9323 Accepted Submission(s): 4405Problem DescriptionIgnatius ha原创 2017-07-02 21:45:00 · 383 阅读 · 0 评论 -
HDU1069——Monkey and Banana(动态规划)
Monkey and BananaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15100 Accepted Submission(s): 7997Problem DescriptionA group原创 2017-07-02 21:42:29 · 314 阅读 · 0 评论 -
最优二叉查找树详解(算法导论学习笔记)
代码均未经过严格测试,仅供参考最优二叉查找树动态规划原理动态规划与分治法相似,都是通过组合子问题的解来求解原问题。动态规划通常是用来求解最优化问题(optimization problem).这类问题可以有很多个可行解,每个解都有一个值,我们希望寻找最优值(最大值或者最小值)的解。我们称这样的解为问题的一个最优解(oneoptimization solution)而不是最优解(theoptimiz原创 2017-06-08 09:04:14 · 20017 阅读 · 1 评论 -
codefoces 812B——Sagheer, the Hausmeister(动态规划)
B. Sagheer, the Hausmeistertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSome people leave the lights at原创 2017-06-02 10:20:43 · 638 阅读 · 0 评论 -
POJ1661——Help Jimmy(动态规划)
Help JimmyTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 11553 Accepted: 3790Description"Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低原创 2017-05-28 23:16:20 · 451 阅读 · 0 评论 -
POJ1458————Common Subsequence
Common SubsequenceTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 52488 Accepted: 21709DescriptionA subsequence of a given sequence is the given seque原创 2017-05-28 23:05:31 · 342 阅读 · 0 评论 -
HDU5543——Pick The Sticks(动态规划)
Pick The SticksTime Limit: 15000/10000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1336 Accepted Submission(s): 443Problem DescriptionThe story原创 2016-10-14 16:39:21 · 390 阅读 · 0 评论 -
GarsiaWachs算法的应用(POJ1738,51NOD1023)
先把两个题都贴出来看看吧An old Stone GameTime Limit: 5000MS Memory Limit: 30000KTotal Submissions: 3383 Accepted: 940DescriptionThere is an old stone game.At the begi原创 2016-09-07 08:48:40 · 1356 阅读 · 4 评论 -
POJ1631——Bridging signals(动态规划,最长上升子序列应用)
B - Bridging signalsTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %lluSubmit Status Practice POJ 1631Appoint description: System Crawler (Jul 15, 2016 8:10:06 AM原创 2016-07-21 14:17:03 · 520 阅读 · 0 评论 -
POJ1065——Wooden Sticks(动态规划,二分优化)
原题如下:Wooden SticksTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 21590 Accepted: 9197DescriptionThere is a pile of n wooden sticks. The length原创 2016-07-21 13:36:21 · 693 阅读 · 0 评论 -
【转】POJ3181——Dollar Dayz(完全背包优化)
看到一篇很棒的题解,存下来。书上一直没明白的看这个题解瞬间打通任督六脉。 原博客地址:http://www.hankcs.com/program/cpp/poj-3181-dollar-dayz.html原题如下: Dollar Dayz Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6032 Acce转载 2016-07-21 11:28:20 · 631 阅读 · 0 评论 -
POJ3046——Ant Counting(dp算法)
先占个坑不知道为啥一直 wa简单dp#include #include #include #include using namespace std;#define MAXN 1010#define INF 1e9+7#define MODE 1000000int t,a,s,b;int m[MAXN];long long dp[MAXN][MAXN];原创 2016-07-18 11:17:26 · 333 阅读 · 0 评论 -
51NOD 1183——编辑距离(动态规划基础)
1183 编辑距离基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注编辑距离,又称Levenshtein距离(也叫做Edit Distance),是指两个字串之间,由一个转成另一个所需的最少编辑操作次数。许可的编辑操作包括将一个字符替换成另一个字符,插入一个字符,删除一个字符。例如将kitten一原创 2016-07-21 09:35:52 · 497 阅读 · 0 评论 -
POJ2955——Brackets(区间dp)
BracketsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6335 Accepted: 3388DescriptionWe give the following inductive definition of a “regular brack原创 2016-08-15 23:27:05 · 302 阅读 · 0 评论 -
HDU5745(2016多校第二场)——La Vie en rose(bitset,动态规划)
La Vie en roseTime Limit: 7000/3500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2329 Accepted Submission(s): 706Problem DescriptionProfessor Zh原创 2016-08-15 20:17:57 · 607 阅读 · 0 评论 -
10635 - Prince and Princess(最长公共子序列优化,动态规划)
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1576题意:就是求两个序列的最长公共子序列思路:因为数据量是10^5的,一般的n^2的算法会TML。所以得优化,就是把a中出现的数,在b中出现过的对应的位置记录下来,然后用nlgn的原创 2016-08-03 20:29:55 · 511 阅读 · 0 评论