
【动态规划】
xia842655187
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu 3466 Proud Merchants (排序的dp)
/*HDU 3466需要排序的01背包*/hdu 3466 Proud MerchantsProblem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in this country are still very prou原创 2015-08-04 15:41:16 · 1077 阅读 · 2 评论 -
HDU 1003 Max Sum(经典DP,)
Max Sum DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence原创 2016-05-06 19:45:51 · 580 阅读 · 0 评论 -
POJ 2250 & UVA 531 Compromise(字符串、 最长公共子序列)
Compromise题目: 题目大意:这里有两篇短文,每篇短文有若干个单词,求这两篇短文中的最长公共子序列,并将其输出来!没篇短文输入 为 “#” 时,结束该篇短文的输入。这道题是多组测试数据,如果只写一组,那么就会 WA,我因为这就被 WA 了一次!最长公共子序列的解法,就不多说了,基本上所有的算法书上都有介绍讲解。原创 2016-05-06 20:16:10 · 560 阅读 · 0 评论 -
HDU 2069 & UVA 674 Coin Change(换硬币 dp 入门经典水题,背包问题)
Coin ChangeTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u DescriptionSuppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-...原创 2016-05-06 20:35:02 · 2674 阅读 · 8 评论 -
UVA 10003 Cutting Sticks(区间 DP)
Cutting SticksTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu题目:题目大意:题目说的是有一根长为 l 的木棍,现在想要在其中 n 个位置切 开,但是每次切都需要花费所切的棒子的长度的钱数,求最少话多少钱。刚开始拿原创 2016-05-06 21:12:56 · 630 阅读 · 0 评论 -
UVA 348 & ZOJ 1276 Optimal Array Multiplication Sequence(dp , 矩阵链相乘问题)
Optimal Array Multiplication SequenceTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluDescriptionGiven two arrays A and B, we can determine the array C原创 2016-05-06 21:40:13 · 627 阅读 · 0 评论 -
HDU 1520 & POJ 2342 Anniversary party(树形dp)
Anniversary partyTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uDescriptionThere is going to be a party to celebrate the 80-th Anniversary of t原创 2016-05-06 21:34:34 · 574 阅读 · 0 评论 -
经典的01背包问题(挖金矿)
虽然有点长,但是这确实是一个非常01背包问题,很适合学习01背包的时候学习,很一篇很不错的教材经典的01背包问题对于动态规划,每个刚接触的人都需要一段时间来理解,特别是第一次接触的时候总是想不通为什么这种方法可行,这篇文章就是为了帮助大家理解动态规划,并通过讲解基本的01背包问题来引导读者如何去思考动态规划。本文力求通俗易懂,无异性,不让读者感到迷惑,引导读者去思考,所以如原创 2016-05-07 09:38:45 · 6109 阅读 · 0 评论 -
UVA 10739 String to Palindrome (增删字符将非回文串串变身回文串,动态规划dp )
H - String to PalindromeTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluDescription题目大意:给你一个字符串,让你给他变成回文字符串。你可以对这个字符串进行三种方式的更改。● 删除字符● 更改字符原创 2016-05-21 10:39:50 · 659 阅读 · 0 评论 -
HDU 1619 & UVA 116 Unidirectional TSP(树形dp,入门 , 数塔变形)
Unidirectional TSPDescriptionBackgroundProblems that require minimum paths through some domain appear in many different areas of computer science. For example, one of the const原创 2016-05-06 18:06:44 · 806 阅读 · 0 评论 -
UVA 10534 Wavio Sequence(二分 + 最长上升子序列)
Wavio Sequence题目:题目大意:题目是给一个序列,然后再其序列中找一个子序列,这个子序列符合前一半是递增的序列,后半部分是递减的序列,并且是这个序列中所有符合条件的子序列中最长的,输出其长度。思路分析:题目读懂以后,解法就迎刃而出了,很显然,正着求一个最长上升子序列,倒着求一个最长上升子序列。然后从这两个序列中找重原创 2016-05-06 17:43:04 · 1043 阅读 · 0 评论 -
UVA 11368 & POJ 3636 & HDU 1677 Nested Dolls(贪心 + 二分LIS)
A - Nested DollsTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uDescriptionDilworth is the world’s most prominent collector of Russian nested dolls: h原创 2016-05-06 17:15:57 · 1242 阅读 · 0 评论 -
动态规划(dp) 之 状态转移方程
-----机器分配问题 F[I,j]:=max(f[i-1,k]+w[i,j-k]) 2. 资源问题2 ------01背包问题 F[I,j]:=max(f[i-1,j-v[i]]+w[i],f[i-1,j]); 3. 线性动态规划1 -----朴素最长非降子序列 F[i]:=max{f[j]+1} 4. 剖分问题1 -----石子合并原创 2015-08-06 16:00:12 · 3632 阅读 · 0 评论 -
HDU 1176 免费馅饼(DP)
免费馅饼 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)原创 2015-11-07 22:14:35 · 520 阅读 · 0 评论 -
HDU 1176(NYOJ 613) 免费馅饼(dp)
免费馅饼 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)原创 2015-10-09 19:11:23 · 357 阅读 · 0 评论 -
HDU 2955 Robberies (01背包dp)
RobberiesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16848 Accepted Submission(s): 6217Problem Descri原创 2015-09-24 20:41:08 · 351 阅读 · 0 评论 -
NYOJ 252 01串(dp,递推)
01串时间限制:1000 ms | 内存限制:65535 KB难度:2描述ACM的zyc在研究01串,他知道某一01串的长度,但他想知道不含有“11”子串的这种长度的01串共有多少个,他希望你能帮帮他。注:01串的长度为2时,有3种:00,01,10。输入第一行有一个整数n(0随后有n行,每原创 2015-10-08 20:27:49 · 355 阅读 · 0 评论 -
UVA 825 Walking on the Safe Side(DP)
Walking on the Safe SideSquare City is a very easy place for people to walk around. The two-way streets run North-South orEast-West dividing the city into regular blocks. Most street intersectio原创 2016-04-01 10:57:25 · 415 阅读 · 0 评论 -
动态规划理论思想
动态规划的理论思想还是不能够深入理解,于是就重新看了一下,并将其转载了过来转自:http://blog.youkuaiyun.com/liuxucoder终于讲到动态规划了~该来的总会来的……作为算法的一大核心,我大动态规划的影响力不可谓不大。很多工业级的算法里,都清晰可见动态规划的模样。 你问我为何这么普及?道理很简单。丫的动态规划也是一种思想!!!原创 2016-04-30 17:54:08 · 1145 阅读 · 0 评论 -
UVA 111 History Grading (最长公共子序列)
History GradingTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluBackgroundMany problems in Computer Science involve maximizing some measure according to constraints.原创 2016-04-20 19:21:22 · 1179 阅读 · 0 评论 -
大牛的《背包九讲》
大牛的《背包九讲》P01: 01背包问题 题目 有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使这些物品的费用总和不超过背包容量,且价值总和最大。 基本思路 这是最基础的背包问题,特点是:每种物品仅有一件,可以选择放或不放。 用子问题定义状态:即f[i][v]表示前i件物品恰放入一个容量为v的背包原创 2016-05-06 20:42:10 · 1371 阅读 · 0 评论