QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 64 MB Total points: 100

#12853. 哥德巴赫猜想

Statistics

令 $d(x)$ 为 $x$ 的所有约数之和。如果从 $1$ 到 $d(x)$ 的每个整数都可以表示为 $x$ 的若干个不同约数之和,则称 $x$ 为一个“好数”。

例如,$6$ 是一个好数,$d(6) = 1 + 2 + 3 + 6 = 12$,$4 = 1 + 3$,$5 = 2 + 3$,$7 = 1 + 6$ 等等。

Teacher Mai 想知道一个偶数 $q$ 是否可以表示为两个好数之和。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 4 \cdot 10^4$),表示测试用例的数量。

对于每个测试用例,只有一行,包含一个偶数 $q$ ($1 \le q \le 10^{18}$)。

大多数测试用例是随机生成的。

输出格式

对于每个测试用例,第一行输出 “YES” 或 “NO”,表示 $q$ 是否可以表示为两个好数之和。

如果答案为 “YES”,在第二行输出两个数 $a$ 和 $b$。$a$ 和 $b$ 都必须是好数,且 $a + b = q$。

在第三行和第四行,分别输出 $a$ 和 $b$ 的质因数分解。如果 $a = \prod_{i=1}^{k} p_i^{e_i}$,其中 $p_1 < p_2 < \dots < p_k$,$p_i$ 为质数且 $e_i \ge 1$,则应先输出 $k$,然后输出 $2k$ 个空格分隔的数字 $p_1, e_1, p_2, e_2, \dots, p_k, e_k$。

样例

样例输入 1

1
18

样例输出 1

YES
6 12
2 2 1 3 1
2 2 2 3 1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.