本文共 894 字,大约阅读时间需要 2 分钟。
1、
2、题目:
对于每个子串,求出 母串中 所有该子串 的 开始和结束位置,保存在 mark数组中,求完所有子串后,对mark数组按 结束位置排序,然后 用后一个的结束位置 减去 前一个的 开始 位置 再 减去 1,记录最大值,
Problem 2128 最长子串
输入包含多组数据。第一行为字符串s,字符串s的长度1到10^6次方,第二行是字符串s不能包含的子串个数n,n<=1000。接下来n行字符串,长度不大于100。
字符串由小写的英文字符组成。
3、代码:
#include#include #include using namespace std;#define N 1000005char str[N];char sub[105];int cnt;struct node{ int start; int end;}a[N];int cmp(node a,node b){ return a.end ans) ans=tmp; } if(ans==-1) printf("%d\n",l); else printf("%d\n",ans); } return 0;}/*lgcstraightlalongahisnstreet5strlongtreebigintegerellipse*/
转载地址:http://beddi.baihongyu.com/