poj2406专题

poj2406(连续重复子串)

题意:判断串s是不是str^n,求str的最大长度。 解题思路:kmp可解,后缀数组的倍增算法超时。next[i]表示在第i位匹配失败后,自动跳转到next[i],所以1到next[n]这个串 等于 n-next[n]+1到n这个串。 代码如下; #include<iostream>#include<algorithm>#include<stdio.h>#include<math.

POJ2406 Power Strings 解题报告【字符串】【KMP】

Description Given two strings a and b we define a*b to be their concatenation. For example, if a = “abc” and b = “def” then a*b = “abcdef”. If we think of concatenation as multiplication, exponentiat

(POJ2406)Power Strings KMP算法求最小循环节

Power Strings Description Given two strings a and b we define a*b to be their concatenation. For example, if a = “abc” and b = “def” then a*b = “abcdef”. If we think of concatenation as multiplicati

POJ2406 power strings——哈希/KMP

题目传送门 题目大意: 给定若干个长度 ≤ 106 10 6 10^6的字符串,询问每个字符串最多是由多少个相同的子字符串重复连接而成的。如: ababab a b a b a b ababab 则最多有 3 3 3 个 ababab 连接而成。 样例输入: abcd aaaa ababab . //当读入为.时结束程序 样例输出 1 4 3 这道题是一道