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

建议使用的浏览器:

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

5337:Yet Another XYZ Problem

题目描述
You have two strings $A$ and $B$ which consist of $x,y,z$. Every time, you can do one of the following three operations:

1. Change all the $x$ in A into $y$. This operation costs $Cost0$.
2. Change all the $y$ in A into $z$. This operation costs $Cost1$.
3. Change all the $z$ in A into $x$. This operation costs $Cost2$.

One extra restriction is that when you operate any of these operations, the string $A$ needs to be changed. More specifically, when you operate the first operation, there should be at least one $x$ in string $A$, etc. Please calculate how many different ways there are to change the string $A$ into string $B$, while using not more than $macCost$ total cost. The answer could be very large, so please print the actual answer module $10^9+7$.
输入解释
The first line of the input is a single integer $T\ (T \le 1000)$, indicating the number of testcases.

For each of the testcases, the first line contains four integers $Cost0, Cost1, Cost2, maxCost(1 \le Cost0, Cost1, Cost2 \le 1e18, 0 \le maxCost \le 1e18)$. The second line contains the string $A$, and the third line contains the string $B$. It is guaranteed that the length of $A$ is the same with that of $B$.

The size of the input file is less than $50$ KB.
输出解释
For each testcase, print one integer indicating the answer.
输入样例
3
1 1 1 0
x
x
1 1 1 0
x
y
1 1 1 10
x
x
输出样例
1
0
4
来自杭电HDUOJ的附加信息
Author XJZX
Recommend wange2014

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

源链接: HDU-5337

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

共提交 0

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