PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000024. Cộng và nhân để tạo số (Plus and Multiply)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cộng và nhân để tạo số (Plus and Multiply)
Plus and Multiply
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A set initially contains . Whenever is in the set, both and are included. You may apply the rules repeatedly. Determine whether belongs to this set.
Input
One line containing .
Output
Print Yes if reachable, otherwise No.
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points):
Examples
Input
10 2 3
Output
Yes
Explanation
From , multiply by twice to obtain , then add twice to reach .