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

建议使用的浏览器:

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

7015:Another String

题目描述
Define the distance between two strings of the same length as the numbers of the positions where the characters differ in these two strings.

If two strings of the same length has a distance of no more than $k$, we call these two string satisfy $k-matching$.

Given a string $S$ of length $n$ and a integer $k$. For each $i \in [1, n - 1]$, split $S$ into substrings $A$ and $B$, while $A = S[1,i]$ and $B = S[i + 1, n]$. For all the string pairs formed by some non empty substring of $A$ and some non empty substrings of $B$, count the numbers of pairs satisfying $k-matching$.
输入解释
The first line contains an integer $T\ (T\leq 60)$, denoting the number of test cases.

For each test case, input two integers $n\ (2 \leq n\leq 3000)$ and $k\ (0 \leq k \leq 3000)$ for the first line.

The second line contains $n$ characters denoting the string $S$.

Guarantee that $S$ only contains lowercase letters and the sum of $n$ is no more than $20000$.
输出解释
For each test case, output $n - 1$ lines.

The $i$-th line contains only a integer denoting the number of the pairs for $i$.
输入样例
3
4 0
jslj
6 1
abcazz
5 0
zzzzz
输出样例
1
1
1
5
9
10
8
5
4
8
8
4

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

源链接: HDU-7015

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

共提交 0

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