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

建议使用的浏览器:

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

5282:Senior's String

题目描述
Xuejiejie loves strings most. In order to win the favor of her, a young man has two strings $X$, $Y$ to Xuejiejie. Xuejiejie has never seen such beautiful strings! These days, she is very happy. But Xuejiejie is missish so much, in order to cover up her happiness, she asks the young man a question. In face of Xuejiejie, the young man is flustered. So he asks you for help.

The question is that :
Define the $L$ as the length of the longest common subsequence of $X$ and $Y$.( The subsequence does not need to be continuous
in the string, and a string of length $L$ has $2^L$ subsequences containing the empty string ). Now Xuejiejie comes up with all subsequences of length $L$ of string $X$, she wants to know the number of subsequences which is also the subsequence of string $Y$.
输入解释
In the first line there is an integer $T$, indicates the number of test cases.

In each case:

The first line contains string $X$, a non-empty string consists of lowercase English letters.

The second line contains string $Y$, a non-empty string consists of lowercase English letters.

$1\leq |X|,|Y|\leq 1000$, $|X|$ means the length of $X$.
输出解释
For each test case, output one integer which means the number of subsequences of length $L$ of $X$ which also is the subsequence of string $Y$ modulo $10^9 + 7$.
输入样例
2
a
b
aa
ab
输出样例
1
2
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5282

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

共提交 0

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