string string string

TimeLimit:1000MS  MemoryLimit:32768KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Uncle Mao is a wonderful ACMER. One day he met an easy problem, but Uncle Mao was so lazy that he left the problem to you. I hope you can give him a solution.
Given a string s, we define a substring that happens exactly $k$ times as an important string, and you need to find out how many substrings which are important strings.
Input
The first line contains an integer $T$ ($T\leq 100$) implying the number of test cases.
For each test case, there are two lines:
the first line contains an integer $k$ ($k\geq 1$) which is described above;
the second line contain a string $s$ ($length (s)\leq 10^5$).
It's guaranteed that $\sum{length(s)} \leq 2*10^6$.
Output
For each test case, print the number of the important substrings in a line.
SampleInput
2
2
abcabc
3
abcabcabcabc
SampleOutput
6
9
Submit
题目统计信息详细
总AC数5
通过人数2
尝试人数2
总提交量9
AC率22.22%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签
出处

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: