PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000127. Đếm cặp Goldbach (Goldbach's Conjecture)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm cặp Goldbach (Goldbach's Conjecture)
Goldbach's Conjecture
Source: LightOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given an even integer , count all pairs such that and are prime, , and . Each unordered pair is counted once.
Only the number of valid pairs is required; the pairs themselves do not need to be listed.
Input
One line containing the integer .
Output
Print a single integer: the count of valid pairs (without any Case prefix).
Subtasks
- Subtask 1 (20 points): ; is even.
- Subtask 2 (30 points): ; is even.
- Subtask 3 (50 points): ; is even.
Examples
Input
22
Output
3
Explanation
For , the qualifying pairs are , and . The pair is invalid because is composite. Hence the answer is 3.