#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int len;
char s[];
int net[];
void getnet(){
memset(net,,sizeof(net));
net[]=-;
int k=-,j=;
while(j<len){
if(k==-||s[k]==s[j]){
j++;k++;
net[j]=k;
}
else k=net[k];
}
}
int main(){
while(scanf("%s",s)!=EOF){
len=strlen(s);
getnet();
int tmp=len-net[len];
printf("%d\n",tmp);
}
}
 

F - The Minimum Length的更多相关文章

  1. hust--------The Minimum Length (最短循环节)(kmp)

    F - The Minimum Length Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%lld & %l ...

  2. (KMP 求循环节)The Minimum Length

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=70325#problem/F The Minimum Length Time Limit: ...

  3. [cf contest 893(edu round 33)] F - Subtree Minimum Query

    [cf contest 893(edu round 33)] F - Subtree Minimum Query time limit per test 6 seconds memory limit ...

  4. KMP + 求最小循环节 --- HUST 1010 - The Minimum Length

    The Minimum Length Problem's Link: http://acm.hust.edu.cn/problem/show/1010 Mean: 给你一个字符串,求这个字符串的最小循 ...

  5. hust1010 The Minimum Length

    地址:http://acm.hust.edu.cn/problem/show/1010 题目: 1010 - The Minimum Length Time Limit: 1s Memory Limi ...

  6. Educational Codeforces Round 33 (Rated for Div. 2) F. Subtree Minimum Query(主席树合并)

    题意 给定一棵 \(n\) 个点的带点权树,以 \(1\) 为根, \(m\) 次询问,每次询问给出两个值 \(p, k\) ,求以下值: \(p\) 的子树中距离 \(p \le k\) 的所有点权 ...

  7. HUST 1010 The Minimum Length

    There is a string A. The length of A is less than 1,000,000. I rewrite it again and again. Then I go ...

  8. HUST 1010 The Minimum Length(KMP,最短循环节点,即i-Next[i])

    题意: 有一个字符串A,假设A是“abcdefg”,  由A可以重复组成无线长度的AAAAAAA,即“abcdefgabcdefgabcdefg.....”. 从其中截取一段“abcdefgabcde ...

  9. The Minimum Length - HUST 1010(求最小循环节)

    题意:有个一字符串A(本身不是循环串),然后经过很多次自增变成AAAAA,然后呢从自增串里面切出来一部分串B,用这个串B求出来A的长度.   分析:其实就是求最小循环节.......串的长度 - 最大 ...

随机推荐

  1. 如何用Chrome自带的截屏功能截取超过一个屏幕的网页

    提升程序员工作效率的工具/技巧推荐系列 推荐一个功能强大的文件搜索工具SearchMyFiles 介绍一个好用的免费流程图和UML绘制软件-Diagram Designer 介绍Windows任务管理 ...

  2. scriptPubKey and scriptSig

    First of all two matching scripts are used in two different transactions, one that transfers funds t ...

  3. Gym - 100676G Training Camp (状压dp)

    G. Training Camp[ Color: Yellow ]Montaser is planning to train very hard for ACM JCPC 2015; he has p ...

  4. JS concat() 方法

    [数组元素的合并] 一. concat() 方法 concat() 方法用于连接两个或多个数组. 返回一个新的数组.该数组是通过把所有 arrayX 参数添加到 arrayObject 中生成的.如果 ...

  5. Model 模型

    Model 模型模型是你的数据的唯一的.权威的信息源.它包含你所存储的数据的必要字段和行为.通常,每个模型对应数据库中唯一的一张表. 每个模型都是dhango.db.models.Model 的一个P ...

  6. 模板引擎freemarker的使用(一)

    配置 了解和学习一下freemarker在项目中的配置与使用,顺便记录下来,知识源于分享,进步源于交流... 我是在ssm中配置的. maven 中需要引入的依赖 <!-- freemarker ...

  7. 在windows下.NET CORE 与Consul简单使用

    0)基本概念 consul常用于服务发现 [微服务] web_Api \ \   ->注册服务                                          raft选举le ...

  8. luogu 数列找不同-莫队

    https://www.luogu.org/problemnew/show/P3901 了解过莫队的人应该都清楚,莫队是一个优化的暴力,可以在相对暴力比较优的时间中,求出一段序列内的某些性质(例:数字 ...

  9. 树梅派 -- 通过/sys读写ADC芯片 pcf8591

    通过wiringPi等library, 在user space 通过/dev/i2c来读写i2c设备的方案不在本文讨论了. 编译SENSORS_PCF8591 模块 在Default raspberr ...

  10. c++_方格填数(最新方法)

      方格填数 如下的10个格子 +--+--+--+ | | | |+--+--+--+--+| | | | |+--+--+--+--+| | | |+--+--+--+ (如果显示有问题,也可以参 ...