Choose Integers

AtCoder
IDabc060_b
Time2000ms
Memory256MB
Difficulty
We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of $A$, and you need to select at least one integer. Your objective is to make the sum congruent to $C$ modulo $B$. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. ## Constraints * $1 ≤ A ≤ 100$ * $1 ≤ B ≤ 100$ * $0 ≤ C < B$ ## Input Input is given from Standard Input in the following format: $A$ $B$ $C$ [samples]
Samples
Input #1
7 5 1
Output #1
YES

For example, if you select $7$ and $14$, the sum $21$ is congruent to $1$ modulo $5$.
Input #2
2 2 1
Output #2
NO

The sum of even numbers, no matter how many, is never odd.
Input #3
1 100 97
Output #3
YES

You can select $97$, since you may select multiples of $1$, that is, all integers.
Input #4
40 98 58
Output #4
YES
Input #5
77 42 36
Output #5
NO
API Response (JSON)
{
  "problem": {
    "name": "Choose Integers",
    "description": {
      "content": "We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these,",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc060_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "We ask you to select some number of positive integers, and calculate the sum of them.\nIt is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these,...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments