POJ_1961 KMP next的典型应用 类似于 poj2406
来源:互联网 发布:电脑清理软件 知乎 编辑:程序博客网 时间:2024/05/22 14:21
POJ_1961 KMP next的典型应用 类似于 poj2406
/* * POJ_1961 KMP next的典型应用 类似于 poj2406 * Author : a_clay 2014/05/06 */ #include <iostream>#include <cstdio>#include <string>#include <cstring>#include <algorithm>#include <cmath>#define Bug cout << "here\n";using namespace std;const int M = 1000005;char t[M];int next[M];void get_next(int len) { int i, j; i = 0, j = -1; next[0] = -1; while (i < len) { if (j == -1 || t[i] == t[j]) { i++, j++, next[i] = j; } else { j = next[j]; } }}int main() { int n, ca = 1; while (scanf("%d", &n) && n != 0) { scanf("%s", t); get_next(n); printf("Test case #%d\n", ca++); for (int i = 2; i <= n; i++) { if (i% (i - next[i]) == 0 && i / (i - next[i]) > 1) { printf("%d %d\n", i, i / (i - next[i])); } } printf("\n"); } return 0;}
0 0
- POJ_1961 KMP next的典型应用 类似于 poj2406
- poj2406--kmp next的应用
- KMP(3)--poj2406(next数组的应用)
- poj2406-kmp的next数组的简单应用(2)
- 【POJ2406】Power Strings-KMP中next数组的应用
- POJ2406【KMP-next数组】
- POJ2406 KMP next数组妙用
- POJ2406 Power Strings KMP-next数组的循环节
- POJ2406 Power Strings(KMP next数组的运用)
- poj2406—KMP next数组的性质求最小周期
- poj2406之kmp应用
- POJ_1961 Period(KMP)
- poj_1961 Period(KMP)
- POJ2406 Power Strings next数组应用
- KMP算法中的NEXT数组的应用
- hdu1358 KMP-next数组的应用
- hdu-4763 kmp next数组的应用
- POJ 1961 KMP的next数组应用
- UIImage and NSCoding
- [Linux下Hadoop部署] CentOS6.4_64位下部署Hadoop2.2.0
- uva 11902 - Dominator
- 第九周剩余的题目
- 项目1-存储班长信息的学生类
- POJ_1961 KMP next的典型应用 类似于 poj2406
- 编译机制与自动机——浅显的理解
- RO05 – 如何创建RemObjects SDK 服务(Delphi Version)
- 常用的SQL语句
- ajax请求txt文档
- mini2440裸机小结
- 在U盘里建立git仓库
- ZOJ-1056
- JNI总管——JNIEnv