eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Goldbach`s Conjecture

Goldbach`s Conjecture

The goal of this program is to find all unique ways to represent a given even number as the sum of two prime numbers. A prime number is an integer greater than \textbf{1} that is evenly divisible by only itself and \textbf{1}. The first few prime numbers are \textbf{2}, \textbf{3}, \textbf{5}, \textbf{7}, \textbf{11}, ... The German mathematician Christian Goldbach (1690-1764) conjectured that every even number greater than \textbf{2} can be represented by the sum of two prime numbers. (This conjecture has never been proved nor has a counterexample ever been found. As such, you may assume it is true for the cases considered in this problem.) There may be several ways to represent a given even number by the sum of primes. For example, the even number \textbf{26} may be represented as \textbf{3 + 23}, \textbf{7 + 19}, or \textbf{13 + 13}. \InputFile Input starts with an integer \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{100}) indicating the number of cases. The following \textbf{n} lines each contain a test case of a single even number \textbf{x} (\textbf{4} ≤ \textbf{x} ≤ \textbf{32000}). \OutputFile For each test case \textbf{x}, give the number of unique ways that \textbf{x} can be represented as a sum of two primes. Then list the sums (one sum per line) in increasing order of the first addend. The first addend must always be less than or equal to the second to avoid duplicates. Print a blank line between each pair of test cases.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
3
4
26
100
Вихідні дані #1
4 has 1 representation(s)
2+2

26 has 3 representation(s)
3+23
7+19
13+13

100 has 6 representation(s)
3+97
11+89
17+83
29+71
41+59
47+53
Джерело 2013 ACM-ICPC North American Qualification Contest