PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000021. Số chỉ có thừa số 2 và 3 (3-smooth Numbers)
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ố chỉ có thừa số 2 và 3 (3-smooth Numbers)
3-smooth Numbers
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is 3-smooth if integers exist with . For positive integer , this is equivalent to having no prime factors besides and . The exponents may be zero, so is valid. Determine whether has this form.
Input
One line contains positive integer .
Output
Print Yes if for suitable exponents, or No otherwise.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
324
Output
Yes
Explanation
We have ; choose and print Yes.
Input
5
Output
No
Explanation
The prime factor is neither nor , so the required representation does not exist. Print No.
Input
1
Output
Yes
Explanation
Set . Then , so print Yes.