Problem A. fraction
时间限制 1000 ms
内存限制 256 MB
Many problems require printing the probability of something. Moreover, it is common that if the answer is $\frac{a}{b}$, you should output $a \times b^{-1} \pmod{p}$ ($p$ is a prime number). In these problems, you cannot know the exact value of the probability. It's so confusing!!! Now, we want to reverse engineer the exact probability from such calculated output value $x$. We do so by guessing the probability is the one with the minimum $b$ such that $a \times b^{-1} = x \pmod{p}$. Now we invite you to solve this problem with us!
You are given two positive integers $p$ and $x$, where $p$ is a prime number.
Please find the smallest positive integer $b$ such that there exist some positive integer $a$ satisfying $a < b$ and $a \equiv bx \pmod{p}$.
输入数据
输出数据
For each test, output a line containing a string represents the fraction $\frac{a}{b}$ using the format "a/b" (without quotes).
样例输入
复制
3
11 7
998244353 554580197
998244353 998244352
样例输出
复制
2/5
8/9
499122176/499122177
$ Mathjax font initiator $