摘要: 1 void LCS() 2 { 3 int i; 4 int j; 5 for(i=1; i= length[i][j-1])14 {15 length[i][j] = length[i-1][j];16 }17 else18 {19 length[i][j] = length[i][j-1];20 }21 }22 }23 }View Code 滚动数组: 1 ... 阅读全文
posted @ 2013-08-30 19:25 pc.... 阅读(78) 评论(0) 推荐(0)
摘要: http://blog.csdn.net/ggggiqnypgjg/article/details/6645824 阅读全文
posted @ 2013-08-30 16:39 pc.... 阅读(73) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4513题意: 找出给定的序列中最长的回文串,但有一个要求,必须是从左边到中间中的每一个数字,左边的都要小于等于右边的,而中间到右边的则相反。坑爹: 如果暴力的话要O(n^2) 而n最大能到100000,所以暴力是不行的。解法: Manacher的算法的模板,大约复杂度为O(n)。 1 #include 2 using namespace std; 3 4 const int maxn = 110000 + 10; 5 const int INF = 0x3fffffff; 6 7 int str[m... 阅读全文
posted @ 2013-08-30 16:37 pc.... 阅读(467) 评论(0) 推荐(0)