PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000002. Kiểm tra tính nguyên tố (Primality Test)
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 tính nguyên tố (Primality Test)
Primality Test
Source: CodeChef
Version: Phuoc Hung OJ Extended
Problem Statement
Alice asks Bob to determine whether a given integer is prime. An integer is prime if it is greater than and has no positive divisors other than and itself. Note that is not prime.
Input
One line containing the integer to test.
Output
Print yes if is prime; otherwise print no. Both words are lowercase.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
23
Output
yes
Explanation
The input integer is . It has no divisor other than and itself, so it is prime. Therefore the output is yes.
Input
20
Output
no
Explanation
The input integer is . It has a proper divisor, so it is not prime. Therefore the output is no.
Input
1
Output
no
Explanation
The input integer is . It is less than and is not prime. Therefore the output is no.