Problems > Two Kinds of Stamps

Two Kinds of Stamps

Difficulty: 1300 2000 ms 128 MB

math

Stamps come in values A and B (unlimited supply). Can you make EXACTLY the postage T?

Input: one line with three integers A, B, T.

Output: YES or NO.

Constraints:

  • 1 ≤ A, B ≤ 109
  • 0 ≤ T ≤ 1018

Sample Tests

Input 1
3 5 7
Output 1
NO
Input 2
3 5 8
Output 2
YES

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.