本文共 1487 字,大约阅读时间需要 4 分钟。
题目地址:
题意:求两组字符串中最大的按顺序出现的相同单词数目。
思路:将字串中的连续的字母认作一个单词,依次计算出两个字符串中的单词,其中第1个字符串的单词序列为t1.word[1]…..t1.word[n],第2个字符串的单词序列为t2.word[1]…..t2.word[m]。然后将每个单词当成一个字符,使用LCS算法计算出两个字符串的最长公共子序列,该序列的长度就是最长匹配。
#include #include #include #include #include #include #include #include #include #include #include
转载地址:http://hdsaf.baihongyu.com/