PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000130. Biểu diễn thành tổng bốn nguyên tố (Summation of Four Primes)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Biểu diễn thành tổng bốn nguyên tố (Summation of Four Primes)
Summation of Four Primes
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , find four positive primes (repetitions allowed) such that . The primes need not be distinct or sorted. If it is impossible, report impossibility.
Input
One line containing the integer .
Output
If a representation exists, print four space-separated primes whose sum is . Any valid representation is accepted. Otherwise, print exactly Impossible..
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
24
Output
2 2 3 17
Explanation
For , . Each of , and is prime, and may appear twice. Thus 2 2 3 17 is valid, although other representations are also allowed.