C. [GESP202609 五级] 哥德巴赫猜想

    远端评测题 1000ms 512MiB

[GESP202609 五级] 哥德巴赫猜想

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Description

As everyone knows, Goldbach's conjecture says that any even number greater than 22 can be written as the sum of two prime numbers. For example:

  • 4=2+24=2+2
  • 6=3+36=3+3
  • 8=3+58=3+5
  • 10=3+7=5+510=3+7=5+5

You surely want to know: for an even number nn greater than 22, how many ways are there to write it as the sum of two primes? For example, 44, 66, and 88 each have only one way, while 1010 has two ways. Please write a program to compute the answer.

In this problem, we consider two representations different if and only if the sets of primes used in the two representations are different. That is, 10=3+710=3+7 and 10=7+310=7+3 are the same representation and must not be counted twice.

Input Format

One line containing an even integer nn greater than 22.

Output Format

One line containing an integer, representing the number of ways to write nn as the sum of two primes.

4
1
10
2

Hint

For 40%40\% of the test points, 4≤n≤1004 \le n \le 100 is guaranteed.

For all test points, 4≤n≤1064 \le n \le 10^6 is guaranteed.

Translated by ChatGPT 5

11月第3周刷题

未认领
状态
已结束
题目
6
开始时间
2026-11-18 0:00
截止时间
2026-11-26 23:59
可延期
24 小时