随笔分类 - 动态规划---LCS
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 1005 8 int dp[N+1][N+1]; 9 int b[N+1][N+1]; 10 char str1[N],str2[N]; 11 void lcs(int len1,int l...
阅读全文
摘要:给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。 比如两个串为: abcicba abdkscab ab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。 给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。 比如两个串为
阅读全文
摘要:A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, ..., xm> another se
阅读全文