题目链接

 #include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
inline ll read(){
int x=,f=;char ch=getchar();
while(ch>''||ch<''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
} /***********************************************************/ const int maxn = 1e6+;
char s[maxn];
int Next[maxn]; int main(){
int t;
t = read();
while(t--){
scanf("%s", s);
int len = strlen(s);
Next[] = -;
int k = -;
for(int i = ;i <= len;){
if(k == - || s[i] == s[k]){
Next[++i] = ++k;
}
else k = Next[k];
}
int ans = ;
for(int i = Next[len];i >= ;i--){
if(ans) break;
for(int j = len - i;j >= i;j--){
if(Next[j] >= i){
ans = i;
break;
}
}
}
printf("%d\n", ans);
}
return ;
}

Theme Section的更多相关文章

  1. Theme Section(KMP应用 HDU4763)

    Theme Section Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...

  2. hdu 4763 Theme Section(KMP水题)

    Theme Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) To ...

  3. HDU 4763 Theme Section

    题目: It's time for music! A lot of popular musicians are invited to join us in the music festival. Ea ...

  4. HDU 4763 Theme Section(KMP灵活应用)

    Theme Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) To ...

  5. hdu4763 Theme Section【next数组应用】

    Theme Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  6. HDU 4763 Theme Section (2013长春网络赛1005,KMP)

    Theme Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  7. (KMP灵活运用 利用Next数组 )Theme Section -- hdu -- 4763

    http://acm.hdu.edu.cn/showproblem.php?pid=4763 Theme Section Time Limit: 2000/1000 MS (Java/Others)  ...

  8. hdu4763 Theme Section

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=4763 题目: Theme Section Time Limit: 2000/1000 MS (Java/O ...

  9. HDU4763 Theme Section —— KMP next数组

    题目链接:https://vjudge.net/problem/HDU-4763 Theme Section Time Limit: 2000/1000 MS (Java/Others)    Mem ...

  10. HDU4763 Theme Section 【KMP】

    Theme Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) To ...

随机推荐

  1. html5--1.4元素的属性

    html5--1.4元素的属性 学习要点: 1.了解HTML元素属性2.学习两个属性:align和bgcolor 属性的作用就是就为元素提供更多的信息,大多数元素都可以拥有属性 属性的语法:<标 ...

  2. HTML font: 12px/1.5 Arial; 是什么意思

    意思是: 字体12像素 行高 1.5em 字体 Arial 可以参考下面资料: 我们常用的font属性有下面这六种: font-style设定斜体 如:font-style: italic; font ...

  3. css中字体大小在不同浏览器兼容性问题

    css中使用font-size设定字体大小,不同浏览器的字体height一样,但是width不同,比如在火狐和谷歌中,font-size:20px,字体的高度变为20px,但是谷歌的字体宽度比火狐长 ...

  4. elasticsearch _source字段的一些说明

    _source field The _source field contains the original JSON document body that was passed at index ti ...

  5. 网络编程学习笔记-listen函数

    listen函数使用主动连接套接口变为被连接套接口,使得一个进程可以接受其它进程的请求,从而成为一个服务器进程.在TCP服务器编程中listen函数把进程变为一个服务器,并指定相应的套接字变为被动连接 ...

  6. 小程序js页面设置上导航颜色

    //导航条颜色更改 wx.setNavigationBarColor({ frontColor: '#ffffff', // 必写项 backgroundColor: '#008de6', // 必写 ...

  7. 每天一个linux命令(3):cd命令

    版权声明 更新:2017-04-27博主:LuckyAlan联系:liuwenvip163@163.com声明:吃水不忘挖井人,转载请注明出处! 1 文章介绍 本文介绍了Linux下命令cd. 2 开 ...

  8. MUI框架开发HTML5手机APP

    出处:http://www.cnblogs.com/jerehedu/p/7832808.html  前  言 JRedu 随着HTML5的不断发展,移动开发成为主流趋势!越来越多的公司开始选择使用H ...

  9. 一 Kubernetes介绍

    Kubenetes是一款由Google开发的开源的容器编排工具,它可以解决以下分布式环境下的问题: 调度 你已经得到了这个很棒的基于容器的应用程序? 太棒了!现在你需要确保它能够运行在它应该运行的地方 ...

  10. Java中的内部类介绍(1)

    栗子1: package campu; //外部类 class Out{ private int age =12; //内部类 class In{ public void print(){ Syste ...