PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000195. Số nguyên tố đối xứng
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số nguyên tố đối xứng
Symmetric Primes
Source: LQDOJ ptnk1920symprime
Version: Phuoc Hung OJ Extended (one dataset per execution; batched queries remain together).
Problem Statement
Let be the primes in increasing order. A prime with neighbors is symmetric if
Given queries , print YES if is a symmetric prime and NO otherwise.
Input
First line ; then integers , one per line.
Output
Print YES or NO for each query, in the given order.
Subtasks
- Subtask 1 (20 points): , .
- Subtask 2 (30 points): , .
- Subtask 3 (50 points): , .
Sample Input
3
11
5
373
Sample Output
NO
YES
YES
Sample Explanation
is between consecutive primes and and equals . In contrast, does not equal the average of and .