#GL0000281. Ebony và Ivory (Ebony and Ivory)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Ebony và Ivory (Ebony and Ivory)
Ebony and Ivory
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Dante has weapons Ebony and Ivory. Every Ebony shot deals exactly damage; every Ivory shot deals . To break the shield, exactly damage is needed. Either weapon may be fired a nonnegative number of times. Decide whether nonnegative integers exist such that .
Input
One line contains integers : damage per Ebony shot, per Ivory shot, and target damage.
Output
Print exactly Yes if possible; otherwise print No.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Example 1
Input
4 6 15
Output
No
Explanation
We need 4x+6y=15, with nonnegative integers x,y. Testing all feasible x values leaves no nonnegative integral y.
Example 2
Input
3 2 7
Output
Yes
Explanation
We need 3x+2y=7, with nonnegative integers x,y. Choosing x=1 and y=2 reaches exactly 7 damage.
Example 3
Input
6 11 6
Output
Yes
Explanation
We need 6x+11y=6, with nonnegative integers x,y. Choosing x=1 and y=0 reaches exactly 6 damage.