博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hust——1010F - The Minimum Length(kmp专练)
阅读量:4048 次
发布时间:2019-05-25

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

F - The Minimum Length
Crawling in process...
Crawling failed
Time Limit:1000MS    
Memory Limit:131072KB    
64bit IO Format:%lld & %llu
HUST 1010
Description
 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.     
Input
 Multiply 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.     
Output
 For each line, output an integer, as described above.    
Sample Input
bcabcab
efgabcdefgabcde
Sample Output
3

7

题意是输出循环节的长度   

#include
#include
#include
using namespace std;int nexta[1000010];void getnext(string s){ int i=0,j=-1; nexta[0]=-1; while(i
>s) { getnext(s); k=s.size(); n=k-nexta[k];//循环节 cout<
<

转载地址:http://stfci.baihongyu.com/

你可能感兴趣的文章
Java8 HashMap集合解析
查看>>
欢迎使用CSDN-markdown编辑器
查看>>
Android计算器实现源码分析
查看>>
Android系统构架
查看>>
Android 跨应用程序访问窗口知识点总结
查看>>
各种排序算法的分析及java实现
查看>>
SSH框架总结(框架分析+环境搭建+实例源码下载)
查看>>
自定义 select 下拉框 多选插件
查看>>
js获取url链接携带的参数值
查看>>
gdb 调试core dump
查看>>
gdb debug tips
查看>>
arm linux 生成火焰图
查看>>
linux和windows内存布局验证
查看>>
linux insmod error -1 required key invalid
查看>>
linux kconfig配置
查看>>
linux不同模块completion通信
查看>>
linux printf获得时间戳
查看>>
C语言位扩展
查看>>
linux irqdebug
查看>>
git 常用命令
查看>>