PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000190. Năm, năm ở mọi nơi (Five, Five Everywhere)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Năm, năm ở mọi nơi (Five, Five Everywhere)
Five, Five Everywhere
Phuoc Hung OJ ID: PRIME000195
Source: AtCoder ABC096 D (PHOJ Extended, one input instance per run).
Problem statement
Given , output exactly distinct primes, each at most , such that the sum of any five entries at different positions is composite. Any valid sequence is accepted.
Input
One integer .
Output
One line of distinct primes separated by spaces.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Example
Input
5
Output
11 31 41 61 71
Explanation: All five numbers are distinct primes congruent to 1 modulo 5. Their sum is divisible by 5 and is larger than 5.