码迷,mamicode.com
首页 >  
搜索关键字:dp    ( 24588个结果
2014 Super Training #1 F Passage 概率DP
原题: HDU 3366 http://acm.hdu.edu.cn/showproblem.php?pid=3366本来用贪心去做,怎么都WA,后来看网上原来是一个DP题。首先按P/Q来做排序,即P越大,Q越小就越好,这样可以确保先选最优的路走。dp[i][j]表示已经到了第i条路(说明前i-1条...
分类:其他好文   时间:2014-07-08 00:17:10    阅读次数:273
2014 Super Training #1 B Fix 状压DP
原题: HDU 3362http://acm.hdu.edu.cn/showproblem.php?pid=3362开始准备贪心搞,结果发现太难了,一直都没做出来。后来才知道要用状压DP。题意:题目给出n(n #include #include #include #include #define M...
分类:其他好文   时间:2014-07-07 23:35:56    阅读次数:323
wioi 1043--方格取数
题目描述:设有N*N的方格图(N 2 #include 3 #include 4 using namespace std; 5 6 int a[11][11]; 7 int dp[11][11][11][11]; 8 const int INF = 999999999; 9 10 int oper....
分类:其他好文   时间:2014-07-07 22:57:53    阅读次数:180
POJ #1080 - Human Gene Functions
A classic 2D DP problem. A disguise of LCS - actually not very hard to decode: it is about 2 sequences' matching, though with a weight value of each m...
分类:其他好文   时间:2014-07-07 19:49:34    阅读次数:217
hdu 超级楼梯 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2041 哦~~对了,这些题读者可以直接忽略,我只是想练习一下自己薄弱的地方......题目意思我就不说了...自从昨晚问完乌冬兄一条DP题之后,“一体就知道系DP啦,而且仲好简单噶DP...”。就深感自己...
分类:其他好文   时间:2014-07-07 17:31:57    阅读次数:317
UESTC 923 稳住GCD DP + GCD
定义:dp[i][j] 表示 在前i个数中,使整个gcd值为j时最少取的数个数。则有方程: gg = gcd(a[i],j)gg == j : 添加这个数gcd不变,不添加, dp[i][j] = dp[i-1][j]gg != j: t添加,更新答案, dp[i][gg] = dp[...
分类:其他好文   时间:2014-06-30 11:29:11    阅读次数:106
Distinct Subsequences
题目 Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some...
分类:其他好文   时间:2014-06-30 09:36:18    阅读次数:192
USACO nocows DP
这题没想出来,直接参考了nocow,太弱了= =。 基本思想是动态规划,因为树是递归结构,所以可以递归分成子问题处理。一个树可以看成根加左子树加右子树,所以根据乘法原理,N个节点放成k层的结构等于i个节点放成k - 1层乘以N - i - 1个节点放在k - 1层的积。 令dp[i][j] 为i个节点放j层的最多可能数量,则dp[i][j] = sum{dp[k][j - 1] * dp[i ...
分类:其他好文   时间:2014-06-29 23:49:12    阅读次数:339
CodeForces 18E Flag 2 dp
题目链接:点击打开链接 #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define N 505 #define inf 1000000009 #define siz 26 char s[N][N]; i...
分类:其他好文   时间:2014-06-29 22:04:26    阅读次数:194
uva 10844 - Bloques(数论+高精度)
题目链接:uva 10844 - Bloques 题目大意:给出一个n,表示有1~n这n个数,问有多少种划分子集的方法。 解题思路:递推+高精度。 1 1 2 2 3 5 5 7 10 15 15 20 27 37 52 dp[i][j]=dp[i?1][j?1]+dp[i][j?1]dp[i][0]=dp[i?1][i?1]ans[i]=dp[i][i] ...
分类:其他好文   时间:2014-06-28 08:24:45    阅读次数:235
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!