jeans专题

poj 3080 Blue Jeans

求n个字符串的大于三的最长公共子序列。kmp+暴搜枚举即可。#include<stdio.h>#include<string.h>char str[10][65];char ans[65],s[65];int next[65];int t,n,max,num;void get_next(char *s,int slen){int i=-1,j=0;memset(next,0,

poj 3080 Blue Jeans(KMP匹配,枚举子串)

链接: http://poj.org/problem?id=3080 题目大意: 给出m(2<=m<=10)个DNA序列, 求出这m个序列中最长的公共字串。如果有多个相同长度的,输出字典序最小的。 分析与总结: 依次枚举所有的子串, 然后再看是否在所有序列中都能够匹配。保存下长度最大且字典序最小的序列。 代码: #include<iostream>

poj 3080 Blue Jeans(KMP+字典序输出)

1、http://poj.org/problem?id=3080 2、题目大意: 给定多组样例,每组样例有n个长度为60的字符串,求这n个字符串中长度最长的公共子串,如果有多个这样的子串,按照字典序输出 3、用KMP算法解决 思路: 从第一个主串开始查找其中的每一个子串是不是在其他子串中可以找到,如果能找到,看长度大小,如果跟最大的相同,则找字典序小的那个, 4.题目: Blue

【POJ3080】Blue Jeans

这道题我们发现每个串的长度只有60 所以对于第一个串(或者选一个你喜欢的)枚举子串分别与其他串KMP匹配 注意长度相等时字典序最小&&长度<3时 no significant commonalities 1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 const int len=60; 5 int