PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000048. Kiểm tra nhiều số nguyên tố (FPRIME)
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 nhiều số nguyên tố (FPRIME)
FPRIME
Source: LQDOJ
Version: Phuoc Hung OJ Extended
Problem Statement
You are given natural numbers . For each , determine whether it is prime. Answer each query independently, preserving input order.
Input
The first line contains a positive integer . Each of the next lines contains one natural number .
Output
Print exactly lines: YES if is prime, and NO otherwise.
Subtasks
- Subtask 1 (20 points): ; for every .
- Subtask 2 (80 points): ; for every .
Examples
Input
2
2
9
Output
YES
NO
Explanation
There are queries. The first number is prime, so print YES. The second number has a nontrivial divisor, so print NO.