1. Portal: http://begin.lydsy.com/JudgeOnline/problem.php?id=2725
To find the number of occurrences of a string in another string
Problem: KMP (Nude)
2. Portal: http://begin.lydsy.com/JudgeOnline/problem.php?id=2732
The main topic: give you a string, let you find the maximum repetition period (the maximum period does not coincide with itself)
Solution: KMP or Extended KMP (but I did not use this method), I use KMP, but always WA, the original is to ask the next array to write the if (hand-shaking life).
OK, write a puzzle: use KMP to find the next array, and then go to recursive next[n], because J=next[next[n]] has been next down until its next is 0 ans+=n-j;
This allows you to find the maximum repetition cycle that is not the same as the mother string, but there is one more problem when you ask for j, it is possible for the recursive time to be n^2, so it is better to change the value of next at each recursion (see Code);
3. Portal: http://begin.lydsy.com/JudgeOnline/problem.php?id=2726
The main idea: to give a matrix of letters, to find a minimum sub-matrix, so that the sub-matrix of the infinite copy expansion after the matrix contains the original matrix, for example
Ababa
Ababa
His smallest repeating sub-matrix is AB
2016--3--16 KMP Exercises