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

建议使用的浏览器:

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

5397:Hack it!

Special Judge 特殊评判
题目描述
Let $f(s)$ be a hash function of string $s$. If $s=s_0s_1\dots s_{n-1}$,$f(s)=(\sum_{i=0}^{n-1} w(s_i)base^i) \bmod r$.

Teacher Mai wants to find two different regular bracket sequences $a,b$ with the same length$(\leq 10^4)$ and the same hash value$(f(a)=f(b))$, where w("(")=$p$,w(")")=$q$.

Let us define a regular brackets sequence in the following way: Empty sequence is a regular sequence. If $S$ is a regular sequence, then $(S)$ is regular sequences. If $A$ and $B$ are regular sequences, then $AB$ is a regular sequence.
输入解释
There are multiple test cases. All the test cases are generated randomly.

For each test case, there is one line contains four numbers $p,q,r,base(1\leq p,q,r,base\leq 10^{18})$
输出解释
For each test case, print two different regular bracket sequences $a,b$ with the same length$(\leq 10^4)$ and the same hash value$(f(a)=f(b))$
输入样例
4 7 37 10
输出样例
((()))
()()()
来自杭电HDUOJ的附加信息
Author xudyh
Recommend wange2014

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

源链接: HDU-5397

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

共提交 0

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