PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000003. Kiểm tra nguyên tố cho nhiều truy vấn (Prime Check)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Kiểm tra nguyên tố cho nhiều truy vấn (Prime Check)
Prime Check
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
You are given integers . For each integer, determine whether it is prime. A prime number is an integer greater than having exactly two positive divisors. Report the result in the input order.
Input
The first line contains the integer , the number of questions. Each of the next lines contains an integer for question .
Output
Print exactly lines. On line , print Yes if is prime, and No otherwise. Capitalization matters.
Subtasks
- Subtask 1 (20 points): , for every .
- Subtask 2 (30 points): , for every .
- Subtask 3 (50 points): , for every .
Examples
Input
4
17
31
35
49
Output
Yes
Yes
No
No
Explanation
Query 1: 17 has no proper positive divisor, print Yes. Query 2: 31 has no proper positive divisor, print Yes. Query 3: 35 is divisible by 5, print No. Query 4: 49 is divisible by 7, print No.