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

建议使用的浏览器:

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

7084:Pty loves string

题目描述
Pty has a string S of length n consisting of lowercase English letters. He denotes the value of string T as the number of occurrences of T in string S.

Now he has Q queries, for each query he gives you x,y. Let the string T be the concatenation of the prefix of length x in the string S and its suffix of length y. He wants you to tell him the value of T.
输入解释
An integer T in the first line indicates the number of tests.

For each test,first line contains two integer n,Q - the length of S and the number of queries.

The second line contains string S of length n consisting of lowercase English letters.

For the next Q lines, each line contains two integers x,y.

$1\le T\le 5,1 \le n, Q \le 2 \times 10^5, 1 \le x, y \le n$
输出解释
For each test,output Q lines in total.

For each query, print the answer in one line.
输入样例
1
6 3
ababaa
1 1
2 1
3 1

输出样例
1
2
1

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

源链接: HDU-7084

最后修改于 2021-10-23T19:11:21+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
20000/10000MS(Java/Others) 524288/524288K(Java/Others)