最搞笑的样例解释(一)

· · 闲话

CF1091G

省流:分解大数 n,交互库提供一个计算器给你使用。

样例输入 1

21

样例输出 1

! 3 7

Note

We start by reading the first line containing the integer n = 21. Then, we ask for:

  1. Square root of 16. The answer is 11, as (11 \cdot 11) \bmod 21 = 121 \bmod 21 = 16. Note that the answer may as well be 10.
  2. Square root of 5. There is no x such that x^2 \bmod 21 = 5, so the output is -1.

We conclude that our calculator is working, stop fooling around and realise that 21 = 3 \cdot 7.