
dp
Mik0u
这个作者很懒,什么都没留下…
展开
-
dp 最大递增子序列
Longest Ordered SubsequenceTime Limit: 2 Seconds Memory Limit: 65536 KBA numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2原创 2015-08-04 14:39:15 · 409 阅读 · 0 评论 -
uva-10534 Wavio Sequence
题目链接题目大意 从前往后n + 1个数都是递增的,然后从递增的最大一个值达到最后都是递减的也是n个数总共2*n+1个数。给你一个值求最长的一个满足上面要求的序列。思路: 从前往后求一次单调递增子序列,从后往前求一次单调递增子序列,每次记录下值然后记录最大值代码:#include#include#include#include#inc原创 2016-05-06 17:33:43 · 497 阅读 · 0 评论 -
uva-531 Compromise
题目链接(复制过来好难看)题目大意: 两个人写下一段话,让你寻找他们两个的最长公共的单词序列。思路: 只需要把最长公共子序列换成存储单词就可以代码:#include#include#includeusing namespace std;char a[105][35];char b[105][35];int dp[105][105];in原创 2016-05-06 17:20:53 · 437 阅读 · 0 评论 -
Anniversary party(树形dp第一步)
DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor re原创 2016-05-06 17:09:03 · 1666 阅读 · 0 评论 -
UVA-10285 Longest Run on a Snowboard
题目拉不过来。。。。戳这里看吧题目大意: 下坡知道么,从高往低走,越走越快。此题是也是这个意思,给你一个矩阵,矩阵每个元素都有相应的值,然后可以滑到上下左右四个方向,每一次都加上1,问能得到最大的值。思路: 看到这个题就dfs了,but 会不会超时鸟~~~~并不会,只要每次都记录起他的值就可以(记忆化搜)更新就可以喽。思路很清晰代码原创 2016-05-06 16:57:09 · 428 阅读 · 0 评论 -
Let Me Count The Ways
DescriptionAfter making a purchase at a large department store, Mel's change was 17 cents. He received 1 dime, 1 nickel, and 2 pennies. Later that day, he was shopping at a convenience store.原创 2016-05-06 16:44:12 · 904 阅读 · 0 评论 -
Unidirectional TSP(dp)
DescriptionBackgroundProblems that require minimum paths through some domain appear in many different areas of computer science. For example, one of the constraints in VLSI routing problem原创 2016-05-06 16:37:58 · 572 阅读 · 0 评论 -
Nested Dolls (单调递增子序列 + 二分)
DescriptionDilworth is the world’s most prominent collector of Russian nested dolls: he literally has thousands of them! You know, the wooden hollow dolls of different sizes of which the smallest原创 2016-05-06 16:20:12 · 752 阅读 · 0 评论 -
UVA-111 History Grading
BackgroundMany problems in Computer Science involve maximizing some measure according to constraints.Consider a history exam in which students are asked to put several historical events into原创 2016-04-21 21:40:57 · 489 阅读 · 0 评论 -
Bone Collector
DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave … Th原创 2016-04-30 17:27:19 · 441 阅读 · 0 评论 -
UVA-348 Optimal Array Multiplication Sequence
DescriptionGiven two arrays A and B, we can determine the array C = AB using the standard definition of matrix multiplication:The number of columns in the A array must be the same as the原创 2016-04-29 16:53:57 · 1516 阅读 · 0 评论 -
nyist 硬币找零(完全背包)
硬币找零时间限制:1000 ms | 内存限制:65535 KB难度:3描述在现实生活中,我们经常遇到硬币找零的问题,例如,在发工资时,财务人员就需要计算最少的找零硬币数,以便他们能从银行拿回最少的硬币数,并保证能用这些硬币发工资。我们应该注意到,人民币的硬币系统是 100,50,20,10,5,2,1,0.5,0.2,0.1,0.05,0.02,0原创 2016-04-29 17:25:52 · 712 阅读 · 0 评论 -
矩形嵌套 ————DAG(有向无环图)上的动态规划
矩形嵌套时间限制:3000 ms | 内存限制:65535 KB难度:4描述有n个矩形,每个矩形可以用a,b来描述,表示长和宽。矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a<c,b<d或者b<c,a<d(相当于旋转X90度)。例如(1,5)可以嵌套在(6,2)内,但不能嵌套在(3,4)中。你的任务是选出尽可能多的矩形排成一行,使得除最后一个外,每一个矩原创 2016-04-27 19:24:15 · 1090 阅读 · 0 评论 -
dp第一步!!!!最长公共子序列 POJ 1458
Common SubsequenceTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 42968 Accepted: 17386DescriptionA subsequence of a given sequence is the given sequenc原创 2015-08-03 16:42:03 · 468 阅读 · 0 评论 -
HDU 5418 TSP + 状态压缩
第一次写状态压缩的题目,遇到很多瓶颈, 不过好在都解决了, 状态压缩确实很难想象,但是如果仔细认真的一步一步做,一定也可以轻松A出来。 下面对遇到的瓶颈进行总结:(我做的是求一个最短路的题目) 先说一下思路,Ps:也是借鉴的其他人。 首先是输入的时候,因为可能两点之间有很多路,所以要在Map数组里面存入那条最短边。 存入之后用弗洛伊德求原创 2016-08-08 10:42:18 · 578 阅读 · 0 评论