1736.
Kirinriki
时间限制 2000 ms
内存限制 64 MB
We define the distance of two strings A and B with same length n is
$dis_{A,B} = \sum\limits_{i=0}^{n-1}|A_{i}-B_{n-1-i}|$
The difference between the two characters is defined as the difference in ASCII.
You should find the maximum length of two non-overlapping substrings in given string S, and the distance between them are less then or equal to m.
输入数据
输出数据
For each test case output one interge denotes the answer : the maximum length of the substring.
样例输入
复制
1
5
abcdefedcb
\n
\n
\n
样例说明
[0, 4] abcde
[5, 9] fedcb
The distance between them is abs('a' - 'b') + abs('b' - 'c') + abs('c' - 'd') + abs('d' - 'e') + abs('e' - 'f') = 5