题目链接

 #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. Linux CentOS系统上安装Eclipse

    Linux CentOS系统上安装Eclipse 1. 下载Eclipse软件 下载网址:http://www.eclipse.org/downloads/packages/release/Juno/ ...

  2. 无法远程连接阿里云的Mysql

    问题描述:昨天使用阿里云安装了Mysql,无法远程连接,排除端口号错误.防火墙.Mysql权限问题后,最后发现是阿里云安全组规则限制问题: 解决方式: 1.访问阿里云控制台,实例-->管理 2. ...

  3. blog真正的首页

    声明:此Django分类下的教程是追梦人物所有,地址http://www.jianshu.com/u/f0c09f959299,本人写在此只是为了巩固复习使用 上一节我们阐明了django的开发流程, ...

  4. 轻量级RPC框架开发

    nio和传统io之间工作机制的差别 自定义rpc框架的设计思路 rpc框架的代码运行流程 第2天 轻量级RPC框架开发 今天内容安排: 1.掌握RPC原理 2.掌握nio操作 3.掌握netty简单的 ...

  5. Lua调用C,C++函数案例

    该程序主要是C++与Lua之间的相互调用示例.执行内容:(1)新建一个lua_State(2)打开常用库,如io,os,table,string等(3)注册C函数(4)导入程序所在目录下所有*.lua ...

  6. highChart数据动态更新

    highChart官网上通过ajax加载数据的例子 上面是第一次生成图表的时候使用 我想动态更新,在已经生成的图表上动态更新 chartBS.series[0].setData(sugarListDa ...

  7. Android的appium实例

    1.查看Android的应用包名和activity的方法   (网上有很多种方法,这里应用的是查看日志的方法) CMD中输入>adb logcat -c                   &g ...

  8. zero to one (2)

    kali虚拟机整理 关于kali的虚拟机,我搞崩过很多次,重新安装了很多次,也遇到了很多问题,有一些解决不了的就重新安装,费时费力,要善于用虚拟机. 关于网络配置的问题 关于网络配置,在这里我想主要记 ...

  9. bzoj 4104 解密运算 —— 思路

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4104 一开始发现了给出的顺序是按这些末尾字符后面的后缀排序得到的: 然后发现可以一个一个把字 ...

  10. bzoj1853幸运数字——容斥原理

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1853 dfs实现容斥原理即可. 注意:若在init中写“cnt++”,则出来后需要先cnt-- ...