随笔分类 -  动态规划

上一页 1 2

hdu 1087 最大上升子序列的和(dp或线段树)
摘要:Super Jumping! Jumping! Jumping!Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23328Accepted Subm... 阅读全文

posted @ 2014-11-13 02:51 雄.. 阅读(593) 评论(0) 推荐(0)

zoj 1425 最大交叉匹配
摘要:Crossed MatchingsTime Limit: 2 Seconds Memory Limit: 65536 KBThere are two rows of positive integer numbers. We can draw one line segment between any... 阅读全文

posted @ 2014-11-11 17:02 雄.. 阅读(221) 评论(0) 推荐(0)

hdu 1250 树形DP
摘要:Anniversary partyTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusAppoint description:DescriptionThere is going to be a p... 阅读全文

posted @ 2014-08-07 21:52 雄.. 阅读(132) 评论(0) 推荐(0)

UVA 10131 Is Bigger Smarter?(DP最长上升子序列)
摘要:DescriptionQuestion 1: Is Bigger Smarter?The ProblemSome people think that the bigger an elephant is, the smarter it is. To disprove this, you want to... 阅读全文

posted @ 2014-08-06 13:52 雄.. 阅读(281) 评论(0) 推荐(0)

UVA 116 Unidirectional TSP(DP最短路字典序)
摘要:DescriptionUnidirectional TSPBackgroundProblems that require minimum paths through some domain appear in many different areas of computer science. For... 阅读全文

posted @ 2014-08-06 11:37 雄.. 阅读(294) 评论(0) 推荐(0)

UVA 10003 Cutting Sticks(区间dp)
摘要:DescriptionCutting SticksYou have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery, Inc. (ACM), charges mone... 阅读全文

posted @ 2014-08-05 23:48 雄.. 阅读(192) 评论(0) 推荐(0)

uva 103 Stacking Boxes(最长上升子序列)
摘要:DescriptionStacking BoxesBackgroundSome concepts in Mathematics and Computer Science are simple in one or two dimensions but become more complex when ... 阅读全文

posted @ 2014-08-05 22:59 雄.. 阅读(184) 评论(0) 推荐(0)

codeforces 449D DP+容斥
摘要:Jzzhu and NumbersTime Limit:2000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64uSubmitStatusAppoint description:DescriptionJzzhu havennon-negative... 阅读全文

posted @ 2014-08-05 16:57 雄.. 阅读(340) 评论(0) 推荐(0)

uva 12723 概率dp
摘要:Dudu is a very starving possum. He currently stands in the first shelf of a fridge. This fridge iscomposed of N shelves, and each shelf has a number Q... 阅读全文

posted @ 2014-07-23 21:03 雄.. 阅读(168) 评论(0) 推荐(0)

zoj 3791 An Easy Game dp
摘要:An Easy GameTime Limit: 2 Seconds Memory Limit: 65536 KBOne day, Edward and Flandre play a game. Flandre will show two 01-strings s1 and s2, the leng... 阅读全文

posted @ 2014-06-03 12:03 雄.. 阅读(248) 评论(0) 推荐(0)

hdu 4301 dp
摘要:Divide ChocolateTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1632Accepted Submission(s): 765Pro... 阅读全文

posted @ 2014-04-15 18:46 雄.. 阅读(194) 评论(0) 推荐(0)

La 3942 字符串+dp
摘要:题目大意:一个字符串,可以分解成若干英语单词的连接(单词可以重复使用),求有多少种方法?#include#include#include#includeusing namespace std;const int maxl=300005;const int maxwn=4005;const int maxwl=105;const int MOD=20071027;const int maxnode=400005;const int sigma_size=26;struct Trie{ int ch[maxnode][sigma_size]; int val[maxnode]; ... 阅读全文

posted @ 2014-03-18 20:54 雄.. 阅读(137) 评论(0) 推荐(0)

hdu 4722 数位dp
摘要:Good NumbersTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 603Accepted Submission(s): 221 Problem DescriptionIf we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number. You are required t 阅读全文

posted @ 2013-09-12 15:46 雄.. 阅读(179) 评论(0) 推荐(0)

uva 11762 数学期望+记忆化搜索
摘要:题目大意:给一个正整数N,每次可以在不超过N的素数中随机选择一个P,如果P是N的约数,则把N变成N/p,否则N不变,问平均情况下需要多少次随机选择,才能把N变成1?分析:根据数学期望的线性和全期望公式可以为每个状态列出一个方程,例如: f(x)=1+f(6)*1/3+f(3)*1/3+f(2)*1/3等式右边的最前面的“1”是指第一次转移,而后面的几项是后续的转移,用全期望公式展开,一般地,设不超过x的素数有p个,其中有g个是x的因子,则f(x)=1+f(x)*(1-g/p)+Σf(x/y)/p边界f(1)=0。移项后整理得f(x)=(Σf(x/y)+p)/g因为x/y#include#inc 阅读全文

posted @ 2013-08-15 13:52 雄.. 阅读(429) 评论(0) 推荐(0)

上一页 1 2

导航