PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000021. Chọn tổng có phần dư yêu cầu (Choose Integers)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Chọn tổng có phần dư yêu cầu (Choose Integers)
Choose Integers
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Choose one or more positive multiples of with no limit on their number or magnitude. Determine whether their sum can have remainder when divided by .
Input
One line containing .
Output
Print YES if possible, otherwise NO.
Subtasks
- Subtask 1 (20 points): ;
- Subtask 2 (30 points): ;
- Subtask 3 (50 points): ;
Examples
Input
7 5 1
Output
YES
Explanation
Choose multiples and . Their sum is , whose remainder modulo is .