当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6661:Acesrc and String Theory

题目描述
Acesrc is a famous string theorist at Nanjing University second to none. He insists that we should always say an important thing $k$ times. He also believes that every string that can be obtained by concatenating $k$ copies of some nonempty string is splendid. So, he always teaches newcomers, ``String theory problems are important! String theory problems are important! ... String theory problems are important!"

Today, he wants to examine whether the newcomers remember his instruction. He presents a string consisting of lower case letters and asks them the number of splendid substrings of the presented string. No one can solve this problem, and they will be scolded for hours. Can you help them solve this problem?

Note that equal splendid substrings occurred in different positions should be counted separately.
输入解释
The first line of input consists of a single integer $T$ $(1 \leq T \leq 10)$, denoting the number of test cases. Each test case starts with a single line of an integer $k$ $(1 \leq k \leq 20)$. The second line of a test case is a string $S$ consisting of lower case letters only, the length of which is between $1$ and $3 \times 10^5$ inclusive. The sum of the lengths of strings in all test cases never exceeds $10^6$.
输出解释
For each test case, print the answer as a single integer in a single line.
输入样例
3
2
aabb
2
abababab
3
abc
输出样例
2
6
0
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6661

最后修改于 2020-10-25T23:33:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/6000MS(Java/Others) 262144/262144K(Java/Others)