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

建议使用的浏览器:

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

6774:String Distance

题目描述
For two strings $S$ and $T$, you can do the following operation for arbitrary number of times: Select a string $S$ or $T$, insert or delete a character at any position. The distance between two strings $S$ and $T$ is defined as the minimum number of operations to make $S$ and $T$ equal.

You will be given two strings $A[1..n],B[1..m]$ and $q$ queries.

In each query, you will be given two integers $l_i$ and $r_i$ ($1\leq l_i\leq r_i\leq n$), you need to find the distance between the continous substring $A[l_i..r_i]$ and the whole string $B$.
输入解释
The first line of the input contains a single integer $T$ ($1 \leq T \leq 10$), the number of test cases.

For each case, the first line of the input contains a string $A$ consists of $n$ ($1\leq n\leq 100\,000$) lower-case English letters.

The second line of the input contains a string $B$ consists of $m$ ($1\leq m\leq 20$) lower-case English letters.

The third line of the input contains a single integer $q$ ($1\leq q\leq 100\,000$), denoting the number of queries.

Then in the following $q$ lines, there are two integers $l_i,r_i$ ($1\leq l_i\leq r_i\leq n$) in each line, denoting a query.
输出解释
For each query, print a single line containing an integer, denoting the answer.
输入样例
1
qaqaqwqaqaq
qaqwqaq
3
1 7
2 8
3 9
输出样例
4
2
0
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6774

最后修改于 2020-10-25T23:34:16+00:00 由爬虫自动更新

共提交 0

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