跳到正文

闲话

最搞笑的样例解释(一)

冷月葬T魂约 2 分钟
原文
文章信息与版本

文章信息

发布
2024年3月12日
收录
2025年12月12日
更新
2026年11月13日
篇幅
约 2 分钟
获赞
1

版本

  1. v1当前

CF1091G

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

样例输入 1

代码
21

样例输出 1

代码
! 3 7

Note

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

  1. (12+16) mod 21=28 mod 21=7(12 + 16) \bmod 21 = 28 \bmod 21 = 7.
  2. (6−10) mod 21=−4 mod 21=17(6 - 10) \bmod 21 = -4 \bmod 21 = 17.
  3. (8⋅15) mod 21=120 mod 21=15(8 \cdot 15) \bmod 21 = 120 \bmod 21 = 15.
  4. (5⋅4−1) mod 21=(5⋅16) mod 21=80 mod 21=17(5 \cdot 4^{-1}) \bmod 21 = (5 \cdot 16) \bmod 21 = 80 \bmod 21 = 17.
  5. Square root of 1616. The answer is 1111, as (11⋅11) mod 21=121 mod 21=16(11 \cdot 11) \bmod 21 = 121 \bmod 21 = 16. Note that the answer may as well be 1010.
  6. Square root of 55. There is no xx such that x2 mod 21=5x^2 \bmod 21 = 5, so the output is −1-1.
  7. (612) mod 21=2176782336 mod 21=15(6^{12}) \bmod 21 = 2176782336 \bmod 21 = 15.

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

原文