上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: 题目:http://poj.org/problem?id=1953题意;求长度为n的01串的个数(11不相邻)。递推,x[i]表示长度为i的01串的个数,那么它可以由在长度为i-1的01串后加0或加1得到; 由限制条件,长度i-1的串后都可以加0,i-1串末尾是0的后面才可以加1; 分两种情况: (... 阅读全文
posted @ 2012-05-09 09:57 开开甲 阅读(345) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1887题目本质:求最长递减子序列的长度。状态转移方程:d[i] = max(1,d[j]+1), 0 2 #define N 5000 3 int missile[N]; 4 int ans[N]; 5 6 int main() 7 { ... 阅读全文
posted @ 2012-05-08 22:43 开开甲 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1579题目说递归很费时,怎么办?递归费时的一个很重要的原因就是很多子问题重复计算了,如果计算过的子问题保存下来,用时直接取来用。就是具备记忆能力的递归了,那样就比较快了。状态转移方程就是题目的递归式了。代码:#include #includ... 阅读全文
posted @ 2012-05-08 21:09 开开甲 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1458简单的经典题。复习下LCS和滚动数组。代码:#include #include char a[1001],b[1001];int d[2][1001];int main(){ int lena,lenb,n,i,j; ... 阅读全文
posted @ 2012-05-06 21:35 开开甲 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1050这个题的基础是最大字段和。我以前写过最大字段和,如下:最大字段和:http://www.cnblogs.com/HpuAcmer/archive/2011/11/27/2264856.html最大子矩阵和的方法和最大字段和一样,转化下... 阅读全文
posted @ 2012-05-05 21:13 开开甲 阅读(1970) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1159思路:找出原串的最长回文子串,当然这里说的回文子串可以不连续。用原串的长度减去最长回文子串的长度即可得出结果。设原串a[5001],它的反串为b[5001],求出a和b的最长公共子串的长度(可以不连续),即为回文子串的长度。再用原串长... 阅读全文
posted @ 2012-05-03 21:13 开开甲 阅读(322) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1080 两个串,求最大匹配度,可以插入‘-’,比如:AGTGATG GTTAG 有2种匹配方案:(1)AGTGAT-G -GT--TAG(2)AGTGATG -GTTA-G a,b串,d[i][j] 表示a[0]~a[i-1]和b[... 阅读全文
posted @ 2012-05-03 19:48 开开甲 阅读(830) 评论(1) 推荐(1) 编辑
摘要: 题目:http://poj.org/problem?id=3176bowl[i][j] += max(bowl[i-1][j-1], bowl[i-1][j]);代码:#include #include int bowl[355][355];int main(){ int row,i,j,tmp... 阅读全文
posted @ 2012-05-01 16:44 开开甲 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1276背包问题。看指定的货币能组合成哪些情况。钱最多且#include #include int a[11],type[11],m[100001];int main(){ int money,num,i,j,k; wh... 阅读全文
posted @ 2012-05-01 16:26 开开甲 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4223题意很简单:n个数,找出连续m个数的最小绝对值。先来个暴搜(N#include #include #define N 1001int a[N];int main(){ int T,n,i,j,min... 阅读全文
posted @ 2012-04-19 09:10 开开甲 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页