dp
背包,LIS,LCS等
DeterminedDiligent
这个作者很懒,什么都没留下…
展开
-
n个骰子的点数【LeetCode】【暴力递归转化为动态规划】
面试题60. n个骰子的点数把n个骰子扔在地上,所有骰子朝上一面的点数之和为s。输入n,打印出s的所有可能的值出现的概率。你需要用一个浮点数数组返回答案,其中第 i 个元素代表这 n 个骰子所能掷出的点数集合中第 i 小的那个的概率。示例 1:输入: 1输出: [0.16667,0.16667,0.16667,0.16667,0.16667,0.16667]示...原创 2020-03-27 22:34:06 · 583 阅读 · 0 评论 -
Advanced Fruits HDU杭电1503【LCS的保存】
Problem DescriptionThe company "21st Century Fruits" has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times this method doe原创 2015-08-11 08:43:41 · 1482 阅读 · 0 评论 -
饭卡 HDU杭电2546 【0-1背包】
http://acm.hdu.edu.cn/showproblem.php?pid=2546Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有原创 2015-08-27 09:48:08 · 329 阅读 · 0 评论 -
Bone Collector HDU杭电2602 【0-1背包】
http://acm.hdu.edu.cn/showproblem.php?pid=2602Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bone原创 2015-08-27 09:44:52 · 318 阅读 · 0 评论 -
杭电2391 Filthy Rich(猥琐的富裕)
Problem DescriptionThey say that in Phrygia, the streets are paved with gold. You’re currently on vacation in Phrygia, and to your astonishment you discover that this is to be taken literally: small原创 2015-03-28 11:31:52 · 426 阅读 · 0 评论 -
Palindrome POJ 1159 【LCS】
Problem DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determ原创 2015-08-10 17:53:04 · 391 阅读 · 0 评论 -
杭电1003 Max Sum
http://acm.hdu.edu.cn/showproblem.php?pid=1003 #includeint main(){ int sum,max,i; int test,n; int a; int num=0; scanf("%d",&test); while(test--) { scanf("%d",&n); max=-100000;s原创 2015-03-21 21:41:22 · 267 阅读 · 0 评论 -
Common Subsequence 杭电HDU1159 【动态规划LCS】
Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there e原创 2015-08-10 11:17:23 · 677 阅读 · 0 评论 -
南阳17 单调递增最长子序列
单调递增最长子序列时间限制:3000 ms | 内存限制:65535 KB难度:4描述 求一个字符串的最长递增子序列的长度如:dabdbf最长递增子序列就是abdf,长度为4输入第一行一个整数0随后的n行,每行有一个字符串,该字符串的长度不会超过10000输出输出字符串的最长递增子序列的长度样例输入3aaaababcabklmn原创 2015-06-08 22:33:38 · 312 阅读 · 0 评论 -
杭电1501 Zipper
Problem DescriptionGiven three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrari原创 2015-06-19 11:38:41 · 402 阅读 · 0 评论 -
杭电 数塔
数塔 Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗? Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 <= N <= 100),表示数塔的高度,接下原创 2015-01-29 17:05:11 · 455 阅读 · 0 评论