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

建议使用的浏览器:

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

6956:Pass!

题目描述
There are \(n\) players passing ball on the football field.

Initially, the first player has the ball. Then each second, the player with ball should pass the ball to any other player.

Alice wonders how many way to pass the ball, such that after \(t\) seconds, the ball will turn back to the first player. So she asks Bob for help.

Now, Bob solved the question and found that the answer modulo \(998244353\) is \(x\). But he forgot the exact number of \(t\). So he ask you for help, to find the smallest non-negative integer \(t\), such that the answer of Alice's question modulo \(998244353\) will be \(x\).
输入解释
The first line contains an integer $T(1\le T\le 100)$representing the number of test cases.

For each test case, there are two integers $n,x(2\le n\le 10^{6}, 0\le x < 998244353)$in one line.
输出解释
For each test case, output a single line containing one integer indicates the smallest $t$. If such $t$ do not exist, output \(-1\) instead.
输入样例
5
11 1
11 0
11 10
11 76805204
11 2
输出样例
0
1
2
233333
-1

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

源链接: HDU-6956

最后修改于 2021-10-23T19:10:49+00:00 由爬虫自动更新

共提交 0

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