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

建议使用的浏览器:

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

7158:ShuanQ

题目描述
CX is a programmer of a mooc company. A few days ago, he took the blame for leakage of users' data. As a result, he has to develop an encryption algorithm, here is his genius idea.

First, the protocol specifies a prime modulus $M$, then the server generates a private key $P$, and sends the client a public key $Q$. Here $Q = P ^ {-1},P \times Q \equiv 1 \mod M$.

Encryption formula: $encrypted\_{data} = raw\_{data} \times P \mod M$

Decryption formula: $raw\_{data} = encrypted\_{data} \times Q \mod M$

It do make sense, however, as a master of number theory, you are going to decrypt it.You have intercepted information about $P, Q, encrypted\_{data}$, and $M$ keeps unknown. If you can decrypt it, output $raw\_{data}$, else, say "shuanQ" to CX.
输入解释
First line has one integer $T(T \leq 20)$, indicating there are $T$ test cases. In each case:

One line has three integers $P, Q, encrypted\_{data}$. ($1 < P, Q, encrypted\_{data} \leq 2 \times 10^6$)

It's guaranteed that $P, Q, encrypted\_{data} < M$.
输出解释
In each case, print an integer $raw\_{data}$, or a string "shuanQ".
输入样例
2
5 5 5
6 6 6
输出样例
shuanQ
1

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

源链接: HDU-7158

最后修改于 2022-09-15T06:17:06+00:00 由爬虫自动更新

共提交 0

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