PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000125. Bài toán tổng hai số nguyên tố (The Primary Problem)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Bài toán tổng hai số nguyên tố (The Primary Problem)
The Primary Problem
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer , determine whether it is a sum of two primes.
If more than one pair satisfies and , choose the pair maximizing . Equal primes are allowed, e.g. .
Input
One line containing the integer .
Output
Print two lines. The first is n:. The second is a+b (without spaces), or NO WAY! if there is no pair.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
10
Output
10:
3+7
Explanation
For , valid prime pairs are and , with differences and . The first pair maximizes the difference, so the second output line is 3+7.