博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher F - The Minimum Length HUST - 1010 (kmp循环节)...
阅读量:4557 次
发布时间:2019-06-08

本文共 1285 字,大约阅读时间需要 4 分钟。

F - The Minimum Length HUST - 1010

题目链接:

题目:

There is a string A. The length of A is less than 1,000,000. I rewrite it again and again. Then I got a new string: AAAAAA...... Now I cut it from two different position and get a new string B. Then, give you the string B, can you tell me the length of the shortest possible string A.
For example, A="abcdefg". I got abcd
efgabcdefgabcdefgabcdefg.... Then I cut the red part: efgabcdefgabcde as string B. From B, you should find out the shortest A.
InputMultiply Test Cases.
For each line there is a string B which contains only lowercase and uppercase charactors.
The length of B is no more than 1,000,000.
OutputFor each line, output an integer, as described above.Sample Input
bcabcabefgabcdefgabcde
Sample Output
37 题意:求最小循环节的长度 思路:kmp中n-next[n]就是最小循环节的长度,由于现在该题不支持提交,我就贴一下我写的
// // Created by HJYL on 2019/8/15.//#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;const int maxn=1e6+10;char str[maxn];int nextt[maxn];void getnext(){ int i=0,j=-1; nextt[0]=-1; int n=strlen(str); while(i

 

 

转载于:https://www.cnblogs.com/Vampire6/p/11360768.html

你可能感兴趣的文章
学号 《信息安全系统设计基础》第7周学习总结(一)
查看>>
POJ1741Tree [点分治]【学习笔记】
查看>>
BZOJ 3238: [Ahoi2013]差异 [后缀自动机]
查看>>
UVA 12633 Super Rooks on Chessboard [fft 生成函数]
查看>>
memcache 启动 failed to start
查看>>
欧拉函数与欧拉定理
查看>>
fzyzojP2984 -- 序列变换问题
查看>>
poj 2888 Magic Bracelet
查看>>
mysql排序让空值NULL排在数字后边
查看>>
Mono for Android 实现高效的导航
查看>>
30多条mysql数据库优化方法,千万级数据库记录查询轻松解决
查看>>
动画制作 手机APP制作以及响应式的实现
查看>>
我的第一篇博文(Winfrom下WebBrowser控件的使用)
查看>>
git使用笔记(六)github
查看>>
30+ 强大的Buddypress主题–开始您的社区站点吧
查看>>
cinder侧卸载卷流程分析
查看>>
codeforcesD_状压dp
查看>>
windows下通过pid 找到运行程序的路径
查看>>
【字符集】字符集和编码知识【转】
查看>>
不懂技术的人不要对懂技术的人说这很容易实现
查看>>