动态规划
果7
曾就职于阿里巴巴,从事搜索推荐的应用算法工作。
展开
-
HDU 4472 第二次积分赛I题
题目大意:一颗有n个结点的树,根只有一个,下面的处在一层的子节点相同。 题目地址:Count/* 打积分赛的时候,这个题目是我一直在看。 其实那个什么i-1什么约数的当时都写了,只不过没有想到用dp, 而如果i-1为质数的话,只能加1+前面的一项。然后在判断它能怎么拆分,真心想麻烦了。 真的是dp的水题啊!!!*/#include#in原创 2013-07-22 11:17:32 · 1060 阅读 · 0 评论 -
hdu 1024 Max Sum Plus Plus(经典dp) 有点小bug?
Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14654 Accepted Submission(s): 4778Problem DescriptionNow I t原创 2014-01-23 21:20:28 · 1250 阅读 · 0 评论 -
hdu 1025&hdu 1025 LIS(O(n*n)和O(n*log(n)))两种解法
FatMouse's SpeedTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7816 Accepted Submission(s): 3470Special JudgeProblem Description原创 2014-01-24 22:29:39 · 1865 阅读 · 0 评论 -
hdu 1081To The Max(二维最大连续子串和)
To The MaxTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6994 Accepted Submission(s): 3375Problem DescriptionGiven a two-dim原创 2014-01-17 21:49:16 · 1478 阅读 · 0 评论 -
POJ 1837Balance(动态规划 好题)
BalanceTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 9615 Accepted: 5933DescriptionGigel has a strange "balance" and he wants to poise it. Actually, t原创 2014-01-19 20:59:01 · 1443 阅读 · 0 评论 -
hdu 1421搬寝室(简单dp)
搬寝室Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14480 Accepted Submission(s): 4875Problem Description搬寝室是很累的,xhd深有体会.时间追述2原创 2014-02-28 16:08:16 · 1236 阅读 · 0 评论 -
基础背包问题的一些题目!!
hdu1203题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1203每件物品的cos为a[i],价值与b[i]有关,是一个简单的01背包问题。AC代码:#include#include#include#includeusing namespace std;double dp[10005];int a[10005];do原创 2014-01-19 17:59:39 · 1477 阅读 · 0 评论 -
HDU 1992Tiling a Grid With Dominoes(状压dp)
Tiling a Grid With DominoesTime Limit: 1000/500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 410 Accepted Submission(s): 321Problem DescriptionW原创 2014-03-26 22:43:50 · 1964 阅读 · 0 评论 -
POJ 2411Mondriaan's Dream(类似hdu1992铺砖问题)
Mondriaan's DreamTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 10591 Accepted: 6163DescriptionSquares and rectangles fascinated the famous Dutch paint原创 2014-03-27 13:00:04 · 1754 阅读 · 0 评论 -
hdu 1561The more, The Better(树形dp&01背包)
The more, The BetterTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4949 Accepted Submission(s): 2918Problem DescriptionACboy原创 2014-05-09 13:23:05 · 1319 阅读 · 4 评论 -
hdu 1520Anniversary party(简单树形dp)
Anniversary partyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4310 Accepted Submission(s): 1976Problem DescriptionThere is原创 2014-05-08 22:46:30 · 1644 阅读 · 0 评论 -
ZOJ3640 Help Me Escape(概率dp)
p Me EscapeTime Limit: 2 Seconds Memory Limit: 32768 KBBackground If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto th原创 2014-05-19 22:07:42 · 1660 阅读 · 0 评论 -
uva 10635Prince and Princess (LCS转LIS)
B - Prince and PrincessTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionProblem DPrince and PrincessInput: Standard InputOutput: St原创 2014-01-22 18:11:38 · 1845 阅读 · 0 评论 -
hdu 2571&hdu 2577(简单经典dp)
命运Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7640 Accepted Submission(s): 2694Problem Description穿过幽谷意味着离大魔王lemon已经无限接近了原创 2014-01-22 20:17:57 · 1912 阅读 · 0 评论 -
hdu 1069 Monkey and Banana(简单dp)
Monkey and BananaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6406 Accepted Submission(s): 3270Problem DescriptionA group原创 2014-01-22 19:55:42 · 1344 阅读 · 0 评论 -
HDU 4466 Triangle 第二次积分赛C题(思维+简单dp+细心)
题目大意: 给一根长度为n的铁丝,将它分为若干份,不过需要每一份都相似,并且gcd(a,b,c)=1,三边互质 题目地址: Triangle/* 长度为n的铁丝折断成若干相似的三角形。 先计算长度为x的铁丝能组成的相似三角形,再dp。*/#include#include#include#include原创 2013-07-22 23:49:04 · 1533 阅读 · 0 评论 -
HDU 4272LianLianKan 2012长春网络赛F题(思维) 暴力,dfs可以水过,正解是状态压缩dp
LianLianKanTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1848 Accepted Submission(s): 584Problem DescriptionI like playing原创 2013-07-25 13:15:45 · 2442 阅读 · 0 评论 -
Codeforces Round #193 (前两题)
A. Down the Hatch!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEverybody knows that the Berland citizen原创 2013-07-25 19:47:22 · 1304 阅读 · 0 评论 -
HDU 3336 Count the string(KMP+dp)
Count the stringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3132 Accepted Submission(s): 1458Problem DescriptionIt is wel原创 2013-08-03 22:45:22 · 1109 阅读 · 0 评论 -
HDU 4331Image Recognition2012多校第四场A题(暴力枚举+小技巧)
Image RecognitionTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 906 Accepted Submission(s): 340Problem DescriptionNow there原创 2013-08-08 09:53:02 · 1644 阅读 · 3 评论 -
HDU 4489The King’s Ups and Downs(dp递推)
The King’s Ups and DownsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 159 Accepted Submission(s): 98Problem DescriptionThe原创 2013-08-12 12:56:41 · 1364 阅读 · 0 评论 -
codeforces 341C Iahub and Permutations(组合数dp)
C. Iahub and Permutationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIahub is so happy about inventing原创 2013-10-07 11:40:09 · 1916 阅读 · 0 评论 -
hdu 3664Permutation Counting(简单dp)
Permutation CountingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1175 Accepted Submission(s): 589Problem DescriptionGiven原创 2013-11-01 15:09:26 · 1391 阅读 · 0 评论 -
整数划分问题(动态规划)
题目描述:给你一个整数n,比如是4,输出可以将4划分的总数目。可以划分为43 12 2 2 1 1 1 1 1 1 这样总共有五种情况。书上写的是递归实现的方法,很耗费时间,输入100之后还需要5s+的样子才能运行出来。可以直接使用动态规划。 a[n][m]表示总和为n,其中最大的数字是m的总类数。我们所需要求得答案便是a[n][n].原创 2013-11-05 18:42:55 · 1879 阅读 · 0 评论 -
poj 1458&poj 1159 最长公共子序列LCS
Common SubsequenceTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 35240 Accepted: 13986DescriptionA subsequence of a given sequence is the given sequenc原创 2014-01-22 17:48:02 · 1766 阅读 · 0 评论 -
poj 2229&wustoj 1269划分数(简单dp)
1269: 划分数Time Limit: 1 Sec Memory Limit: 128 MB[Submit][Status][Web Board]Problem Description将整数n分成m份,求划分的种数,注意每份不为空,不考虑顺序。比如整数4的划分,1 1 2 和 1 2 1 以及2 1 1 为同一种划分。Input多组测试样原创 2013-11-26 22:46:25 · 2568 阅读 · 2 评论 -
括号匹配(二)NYOJ15(简单区间dp)
携程资格赛B题好吧,连复赛都没进,511.。。。貌似D题是因为没有用unsigned long long?括号匹配(二)时间限制:1000 ms | 内存限制:65535 KB难度:6描述给你一个字符串,里面只包含"(",")","[","]"四种符号,请问你需要至少添加多少个括号才能使这些括号匹配起来。如:[]是匹配的原创 2014-04-13 21:58:00 · 1439 阅读 · 0 评论