POJ2406【KMP-next数组】
来源:互联网 发布:淘宝买保险可靠吗 编辑:程序博客网 时间:2024/05/01 23:16
关于next的解释原文:点点点
//#include <bits/stdc++.h>#include<cstdio>#include<string.h>#include<algorithm>using namespace std;const int N=1e6+10;char s[N];int Next[N],len;void GetNext(){ int i=0,j=-1; Next[0]=-1; while(i<len) { if(j==-1||s[i]==s[j]) Next[++i]=++j; else j=Next[j]; }}int main(){ while(~scanf("%s",s)) { if(strcmp(s,".")==0) break; len=strlen(s); GetNext(); if(len%(len-Next[len])==0) printf("%d\n",len/(len-Next[len])); else printf("%d\n",1); } return 0;}
0 0
- POJ2406【KMP-next数组】
- POJ2406 KMP next数组妙用
- KMP(3)--poj2406(next数组的应用)
- poj2406-kmp的next数组的简单应用(2)
- POJ2406 Power Strings KMP-next数组的循环节
- POJ2406 Power Strings(KMP next数组的运用)
- poj2406—KMP next数组的性质求最小周期
- 【POJ2406】Power Strings-KMP中next数组的应用
- poj2406(next数组理解)
- poj2406--kmp next的应用
- poj2406(kmp,后缀数组)
- KMP算法、next数组与前缀中的周期(相关题目:Power strings, poj2406)
- POJ2406 Power Strings next数组应用
- [KMP][后缀数组] poj2406 Power Strings
- POJ2406 Power Strings 【KMP 或 后缀数组】
- POJ_1961 KMP next的典型应用 类似于 poj2406
- KMP 算法 next数组
- KMP next数组详解
- js中的正则表达式入门
- shell基础
- 波浪图
- CCF201512-3 画图(100分)
- HDU 3497 Mistwald【矩阵乘法】
- POJ2406【KMP-next数组】
- 网络时延
- WEB-JDBC
- Kafka 0.10 KafkaConsumer流程简述
- ListView卡顿分析
- recycler使用详解2--配置多样item布局--适配复杂布局
- Python 爬虫:把廖雪峰的教程转换成 PDF 电子书
- java(22)------java递归算法实例和分析
- WebService(3)_JDK发布WebService