PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000128. Goldbach và Euler (Goldbach and Euler)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Goldbach và Euler (Goldbach and Euler)
Goldbach and Euler
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , determine whether it can be represented by two distinct primes with .
Among all such pairs, select the one with the smallest positive difference . A pair of equal primes is not allowed.
Input
One line containing the integer .
Output
If a valid pair exists, print exactly n is the sum of p1 and p2. (including the final period). Otherwise, print exactly n is not the sum of two primes!.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
12
Output
12 is the sum of 5 and 7.
Explanation
For , contains distinct primes with sum and difference . No pair of distinct primes summing to can have a smaller positive difference. Print 12 is the sum of 5 and 7..