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

建议使用的浏览器:

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

7064:Singing Superstar

题目描述
Ke Ke is a cheerful, enthusiastic girl. She dreams of singing happily every day. One day, while practicing singing, Ke Ke accidentally discovered that there are some words that can make the song better. She called these words "$Superstar Words$".

After a lot of attempts, she found that in each song, there are a total of $n$ "$Superstar Words$". She wants to know the $maximum$ number of $disjoint$ occurrences of each "$Superstar Words$" in her song.

$Note$ : one occurrence means that the $Superstar Word$ is a continuous substring of the song at a certain position.

For example: The $maximum$ number of $disjoint$ occurrences of "aba" in "abababa" is $2$
输入解释
The first line contains an integer $T$$(T\leq5)$, denoting the number of test cases.

The first line of each test case contains one string $s(1\leq |s| \leq 10^5)$, denoting a song.

The second line of each test case contains one integer $n(1\leq n \leq 10^5)$, denoting the number of $Superstar Words$

The next $n$ lines contains contains one string $a_i$($ 1 \leq$ |$a_i$| $\leq 30 $), denoting one $Superstar Words$

It is guaranteed that for all test cases, $\sum |s| \leq 4*10^5$, $\sum |a_i| \leq 4*10^5$

$Note$:All input string character sets are lowercase English letters
输出解释
For each test case, output $n$ lines, each line has one integer, indicating the answer.

输入样例
2
abababbbaanbanananabanana
3
aba
ababa
nana
nihaoxiexiexiaolongbaozaijian
3
qwer
taihaotinleba
xiexi
输出样例
2
1
2
0
0
1

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

源链接: HDU-7064

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

共提交 0

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