Problem:


Score : 200 points

Problem Statement

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

Output

Print YES or NO.

Sample Input 1

7 5 1

Sample Output 1

YES

For example, if you select 7 and 14, the sum 21 is congruent to 1 modulo 5.

Sample Input 2

2 2 1

Sample Output 2

NO

The sum of even numbers, no matter how many, is never odd.

Sample Input 3

1 100 97

Sample Output 3

YES

You can select 97, since you may select multiples of 1, that is, all integers.

Sample Input 4

40 98 58

Sample Output 4

YES

Sample Input 5

77 42 36

Sample Output 5

NO



Sample input:
7 5 1


Sample output:
YES

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans='NO'
for i in range(b):
    if (a*i-c)%b==0:
        ans='YES'
        break
print(ans)

Submission status: Accepted

Solution code:
A,B,C = map(int, input().split())

for i in range(A, A*B+1,A):
    if i % B == C:
        flg = True
        break
    else:
        flg = False

print("YES" if flg else "NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
n=0
if c ==0:
  print('YES')
else:
  while True:
    n+=1
    if n==b:
      print('NO')
      break
    if a*n % b == c:
      print ('YES')
      break

Submission status: Accepted

Solution code:
from sys import exit, stdin
A, B, C = [int(_) for _ in stdin.readline().rstrip().split()]
for i in range(1, 101):
    if (A*i)%B == C:
        print('YES')
        exit()
print('NO')

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
for i in range(B):
    if A*i % B == C:
        print("YES")
        exit()
        
print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

for i in range(a, a*b+1, a):
    if i % b == c:
        print('YES')
        exit()

print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
ans = "NO"
for i in range(1,a+1):
    if (b*i+c)%a == 0:
        ans = "YES"
        break
print(ans)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
for i in range(B):
    if (A*i)%B==C:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
sum = 0
remainder_list = []

while True:
    sum += A
    remainder = sum % B
    if remainder not in remainder_list:
        remainder_list.append(remainder)
    else:
        break

if C in remainder_list:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

for i in range(1, B + 2):
    NA = i * A
    if NA % B == C:
        print('YES')
        exit()
print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())

l = []
cnt = 1

while 0 not in l:
    ans = (a*cnt)%b
    l.append(ans)
    cnt += 1
    
if c in l:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

def solve():
    A, B, C = list(map(int, input().split()))

    # A(x1+x2+x3+...+xn)%B == C
    # (x1+x2+x3+...+xn) = Xとおくと
    # A*X%B == C
    # A*X ≡ C (mod B)
    # A*X-C ≡ 0 (mod B)

    for x in range(1, B+1):
        if (A*x-C)%B == 0:
            print("YES")
            return
    print("NO")

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
ans = 'NO'
for i in range(1,100):
    if a*i%b == c:
        ans = 'YES'
print(ans)

Submission status: Accepted

Solution code:
a,b,c = (int(num) for num in input().split())

def gcd(a,b):
    a = a%b
    if a==0:
        return b
    else:
        a,b = b,a
        return gcd(a,b)
            
            
g = gcd(a,b)
if c%g == 0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*- #

a, b, c = map(int, input().split())
ans = "NO"

for i in range(b):
    if (a*i)%b == c:
        ans = "YES"

print(ans)

Submission status: Accepted

Solution code:
import itertools
A, B, C = map(int, input().split())

qs = []
s = 0
for n in itertools.count(1):
    s += A
    q = (s - C) % B
    if q == 0:
        print('YES')
        break
    elif q in qs:
        print('NO')
        break
    else:
        qs.append(q)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

for i in range(1, b):
    if (a * i) % b == c:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
flag = False
for i in range(b):
    if (a*i)%b == c:
        flag = True
if flag:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = (int(x) for x in input().split())

if A % B == C:
    print("YES")
else:
    x = A % B
    i = 2
    word = "NO"
    while A*i % B != x:
        if  A*i % B == C:
            word = "YES"
            break
        i += 1
    print(word)

Submission status: Accepted

Solution code:
import sys
A, B, C = map(int, input().split())
for k in range(10000000):
  if (k * A) % B == C:
    print("YES")
    sys.exit(0)
print("NO");

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())

from fractions import gcd

if C%gcd(A,B)==0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
flag = False
for i in range(B):
  if A*i % B == C:
    flag = True
  else:
    pass
if flag:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans='NO'
for i in range(1,b+1):
    if a*i%b==c :
        ans='YES'
print(ans)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
for i in range(1,100):
    if (A*i)%B==C:
        print('YES')
        break
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
for i in range(100):
    if a*i % b == c:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

Solution code:
import sys
a,b,c=[int(i) for i in input().split()]
for i in range(1,b+1):
    if i*a % b == c:
        print("YES")
        sys.exit()
print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
n=a*b
flag=True
for i in range(1,n+1):
    if (a*i)%b==c:
        flag=False
        break
print("YNEOS"[flag::2])

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

A,B,C = map(int,input().split())
extra = []

import time

now = time.time()

for i in range(B):
    if i*A % B == C:
        print("YES")
        break

    if i == B-1:
        print("NO")

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

A,B,C = map(int,input().split())
extra = []

import time

now = time.time()

mod = A
while True:
    mod += A
    if mod % B == C:
        print("YES")
        break
    if time.time()-now > 1:
        print("NO")
        break

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=0
for i in range(b+1):
    if i*a%b==c:
        ans+=1
if ans==0:
    print("NO")
else:
    print("YES")

Submission status: Accepted

Solution code:
# 入力
A,B,C=map(int,input().split())

# 余りの出現回数を保存する配列
l=[0]*100

# Aに掛ける係数
t=1

while True:
  # 余りを求める
  x=t*A%B

  # 余りがCと一致したら終了
  if x==C:
    print('YES')
    exit()

  # 余りが2回以上出現したら終了
  elif l[x]>0:
    print('NO')
    exit()

  # 余りの出現回数をインクリメント
  else:
    l[x]+=1

  # Aに掛ける係数を+1する（次のAの倍数へ）
  t+=1

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    A, B, C = [int(ele) for ele in input().split()]
    ans = "NO"
    for i in range(10000):
        if (A * i) % B == C:
            ans = "YES"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, c =[int(i) for i in input().split()]
flag_yes = 0
for i in range(1,b+1):
  if i*a%b == c:
    flag_yes =1
    break
if flag_yes == 1:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
A %= B
for i in range(B):
    if A*i%B == C:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
print("YES" if any((a*i)%b==c for i in range(1,b+1)) else "NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
flag=0
for i in range(b):
  if a*i%b==c:
    flag=1
if flag==1:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

for i in range(1, b+1):
    x = (a*i)
    if x % b == c:
        print('YES')
        break
else:
    print('NO')

Submission status: Accepted

Solution code:
import sys
A, B, C = map(int, input().split())

flag = [0] * (B+1)
i = 0

while True:
    i = (i + A) % B
    if i == C:
        break
    if flag[i] == 0:
        flag[i] = 1
    else:
        print('NO')
        sys.exit()

print('YES')

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
a = A
result = 'NO'

for _ in range(10001):
    if A%B == C:
        result = 'YES'
        break
    A += a

print(result)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
a = A
count = 10001
result = 'NO'

while count > 0:
    if A%B == C:
        result = 'YES'
        break
    A += a
    count -= 1

print(result)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

flg = 0
for i in range(1, b+1):
    if (a * i) % b == c:
        flg = 1
        break
if flg:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
def gcd(n,m):
    while n > 0:
        a = n
        n = m % n
        m = a
    return m

A,B,C = map(int,input().split(" "))
print("NO" if C%gcd(A,B) else "YES")

Submission status: Accepted

Solution code:
v = input().split(" ")

a = int(v[0])
b = int(v[1])
c = int(v[2])

amari = []

tmp1 = 0
tmp2 = 0

for i in range(1, b + 1, 1):
    
    tmp1 += a
    
    amari.append(tmp1 % b)

if c in amari:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
f=False
for i in range(1,b+1):
    if i*a%b == c:
        f=True
print('YES' if f else 'NO')

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

for i in range(100):
    if (a*i) % b == c:
        print('YES')
        exit()

print('NO')

Submission status: Accepted

Solution code:
A,B,C = [int(x) for x in input().split()]
li = []
n = 1
while(True):
    i=A*n%B
    if(i in li):
        break
    else:
        li.append(i)
        n+=1
if(C in li):
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=0
for i in range(1,b+1):
    if (a*i)%b==c:
        ans=1
print('YES' if ans==1 else 'NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
def gcd(a,b):
    r=a%b
    while r!=0:t=b;b=r;r=t%b
    return b
print(c%gcd(a,b)and"NO"or"YES")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
i=1
r=[]
while a*i%b not in r:
  r.append(a*i%b)
  i+=1
print('NYOE S'[any(c%q==0for q in r if q>0)::2])

Submission status: Accepted

Solution code:
a, b, c = map(int,input().split())
flg = False
for i in range(a, a*b+1, a):
  if i % b == c:
    flg = True
    break
if flg == True:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

ans = 'NO'
for i in range(1, b+1):
    if a * i % b == c:
        ans = 'YES'
        break

print(ans)

Submission status: Accepted

Solution code:
#60
a, b, c = map(int, input().split())
for i in range(1, b):
    if (a*i)%b == c:
        print("YES")
        break
    if i==b-1:
        print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
ans = 'NO'

for i in range(1,b+1):
	if (a*i)%b == c:
		ans = 'YES'
		break
print(ans)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

mods = set()
for i in range(1, 101):
    n = i*A % B
    if n == C:
        print('YES')
        break
    elif not n in mods:
        mods.add(n)
    else:
        print('NO')
        break

Submission status: Accepted

Solution code:
# ABC060B - Choose Integers
a, b, c = list(map(int, input().rstrip().split()))
for i in range(a, a * b + 1, a):
    if i % b == c:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

Solution code:


a,b,c = map(int, input().split())
ans = False
for i in range(1,b+2):
  if i*a%b==c:
    ans = True

if ans:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
n = 1
while not a * n % b == 0:
    if a * n % b == c:
        print('YES')
        exit()
    n += 1
else:
    if c == 0:
        print('YES')
    else:
        print('NO')

Submission status: Accepted

Solution code:
import sys
from collections import Counter

a, b, c = map(int, input().split())

for i in range(a, b*a+1, a):
    if i % b == c:
        print('YES')
        sys.exit()

print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

is_YES = False
for i in range(0, a*b+1, a):
    if i%b == c:
        is_YES = True
        break

if is_YES:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans="NO"

for i in range (100000):
    if a*i%b==c:
        ans="YES"
        break

print(ans)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

sum_A = A
for i in range(B):
    sum_A += A
    if sum_A % B == C:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

Solution code:

def read_input():
    a, b, c = map(int, input().split())
    return a, b, c


def mymod(x, y):
    return x % y

def submit():
    a, b, c = read_input()

    mods = list(set([mymod(i*a, b) for i in range(1, b)]))
    mods.sort()

    while True:
        temp = []
        for i in range(len(mods)):
            for j in range(len(mods)):
                temp.append(mymod(mods[i] + mods[j], b))
        new_mods = list(set(mods + temp))
        new_mods.sort()

        if mods == new_mods:
            break

        mods = new_mods

    if c in mods:
        print('YES')
    else:
        print('NO')



if __name__ == '__main__':
    submit()

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

ans = False
for i in range(A + 1):
    if (B * i + C) % A == 0:
        ans = True
        break
print('YES' if ans else 'NO')

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
found = False
for i in range(1,B+1):
    if A * i % B == C:
        found = True
if found == True:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
i = 1
ans = "NO"
modlist = []
while True:
    if (B * i + C) % A == 0:
        ans = "YES"
        break
    else:
        modlist.append((B * i + C) % A)
        i += 1
    if len(modlist) != len(set(modlist)):
        break
print(ans)

Submission status: Accepted

Solution code:
#ABC060B
A, B, C = map(int, input().split())
ok = False
for i in range(1,B+1):
    if i*A % B ==C:
        ok = True
if ok:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
f=False
for i in range(b):
    if a*i%b==c:
        f=True
print('YES' if f else 'NO')

Submission status: Accepted

Solution code:
from fractions import gcd
A, B, C = map(int, input().split())
if C % gcd(A, B) == 0:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

for i in range(1, B + 1):
    if A * i % B == C:
        print("YES")
        exit()

print("NO")

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
x = 0
f = False
for i in range(B):
  x = (x + A) % B
  if x == C:
    f = True
if f or C % A == 0:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
def main():
    input = sys.stdin.readline
    try:
        a, b, c = map(int, input().split())
        for i in range(a, a * b, a):
            if i % b == c:
                print("YES")
                break
        else:
            print("NO")

    finally:
        input = None

import sys; sys.setrecursionlimit(50000)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, c = [int(n) for n in input().split()]

for i in range(1, b+1):
    if (i*a) % b == c:
        print('YES')
        break
else:
    print('NO')

Submission status: Accepted

Solution code:
[A,B,C] = list(map(int,input().split()))
ans = "NO"
for i in range(B):
    if A*i%B == C:
        ans = "YES"
print(ans)

Submission status: Accepted

Solution code:

A,B,C = map(int, input().split())

def func(A, B, C):
    i = 1
    sum = 0
    while(True):
        if i%100 == 0:
            break
        sum += A
        i+=1
        if sum%B==C:
            print('YES')
            return
    print('NO')

func(A,B,C)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())

n = [i * a % b for i in range(b + 1)]

print('YES' if c in n else 'NO')

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

ans = 'NO'

for i in range(1, 1+B):
    if (A*i) % B == C:
        ans = 'YES'
        break

print(ans)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

rem = []
flg = 0
ct = 1
while True:
    tmp = ct*A
    if tmp % B == C:
        flg = 1
        break
    else:
        if tmp % B not in rem:
            rem.append(tmp % B)
        else:
            break
    ct += 1

print('YES' if flg else 'NO')

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b,c = f()
    a = a%b
    c = c%b
    for i in range(b):
        if (a*i)%b == c:
            print('YES')
            return
    
    print('NO')

solve()

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
def gcd(x, y):
    while x % y != 0:
        x, y = y, x % y
    return y
if a<b:a,b=b,a
print("YES" if c%gcd(a,b)==0 else "NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=0
for i in range(b):
  if (i*a)%b==c:
    ans+=1
print("YES" if ans>0 else "NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans='NO'
A=[]
for i in range(10001):
  A.append((a*i-c)%b)
  if(i>3)and(A[0]==A[-1]):
    break
  if (a*i-c)%b==0:
    ans='YES'
    break
print(ans)

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
print("YES"if C in [A*i%B for i in range(B)]else"NO")

Submission status: Accepted

Solution code:
import fractions

a,b,c = map(int, input().split())
if a % b == 0:
  if c == 0:
    print("YES")
  else:
    print("NO")
else:
  GCD = fractions.gcd(a,b)
  if c % GCD == 0:
    print("YES")
  else:
    print("NO")

Submission status: Accepted

Solution code:
# -*- coding utf-8 -*-

a,b,c=map(int,input().split())
ans="NO"
for i in range(1000000):
    if (a*i-c)%b==0:
        ans='YES'
        break
print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans='NO'
for i in range(10001):
    if (a*i-c)%b==0:
        ans='YES'
        break
print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())

x=a
for i in range(1000):
    if x%b==c:
        print("YES")
        exit()
    else:
        x+=a
print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
flag = 1
for i in range(100):
    if (A*i)%B == C:
        flag = 0
ans = ["YES","NO"]
print(ans[flag])

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
l=[]
m=1
while 1:
    i=(a*m)%b
    if i==c:
        print("YES")
        break
    elif i in l:
        print("NO")
        break
    else:
        l.append(i)
        m+=1

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
d=a%b
if d==0:
    if c==0:
        A=True
    else:
        A=False
else:
    for i in range(1,max(a,b)):
        if (i*d)%b==c:
            A=True
            break
        else:
            A=False
if A:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = [int(item) for item in input().split()]
for i in range(b):
    if (a * i) % b == c:
        print("YES")
        exit()
print("NO")

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())



for i in range(1,b+1):
  if (i * a) % b == c:
    print("YES")
    exit()
    
print("NO")

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

for i in range(1, 10000):
    if A*i % B == C:
        print('YES')
        break
    else: continue
else:
    print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
for bi in range(1, b + 1):
    if a * bi % b == c:
        print('YES')
        exit()
print('NO')

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
i = 0
while True:
    if (i * B + C) % A == 0:
        print('YES')
        break
    else:
        if i > 0 and (i * B) % A == 0:
            print('NO')
            break
        i += 1

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a, b, c = (int(_) for _ in input().split())
    i = 1
    ans = 'NO'
    while i<b:
        if(a*i % b == c):
            ans = 'YES'
            break
        i+=1
            
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

sumA = 0
i = 1
ans = False

while sumA <= A * B + C :
    sumA += i * A
    if sumA % B == C :
        ans = True
        break
    #i += 1

if ans == True :
    print('YES')
else :
    print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
list=[0]*100
for i in range(a*b):
  list[a*i%b] += 1
if list[c] >= 1:
  print('YES')
else:
  print('NO')

Submission status: Accepted

Solution code:
A,B,C=map(int,input().split())
for i in range(1,B):
    if A*i%B==C:
        print("YES")
        exit()
            
print("NO")

Submission status: Accepted

Solution code:
def gcd(x, y):
    while y:
        x, y = y, x%y
    return x

A, B, C = map(int, input().split())

if  C % gcd(A, B) == 0 :
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
flg = 0
for i in range(A, A*B+1):
    if i % A == 0 and i % B == C:
        flg = 1
        break
print('YES') if flg == 1 else print('NO')

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
if c==0:
    print("YES")
elif c%gcd(a,b)==0 and c!=0:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())

amaris = []

flag = False
count = 1
tmp = A
while True:
    amari = tmp % B
    if C == amari:
        flag = True
        break
    if amari in amaris:
        break
    amaris.append(amari)
    count += 1
    tmp = A * count

if flag:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split(' '))

flag = False
for i in range(b):
    if a * i % b == c:
        flag = True
if flag:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
R = {i: False for i in range(B)}
X = 0
while True:
    X += A
    r = X % B
    if r == C:
        print("YES")
        exit()
    if R[r]:
        print("NO")
        exit()
    R[r] = True

Submission status: Accepted

Solution code:
A,B,C = map(int,input().split())
As = [A*i for i in range(1,100)]
if all([a%B!=C for a in As]):
    print("NO")
else:
    print("YES")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
a = a % b
t = a
ans = "NO"
for i in range(b):
    t += a
    if (t % b == c):
        ans = "YES"
print(ans)

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    A, B, C = map(int, input().split())

    for i in range(1, B+1):
        if (A * i) % B == C:
            return 'YES'

    return 'NO'


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
for i in range(1, b + 1):
    if a * i % b == c:
        print('YES')
        exit()
print('NO')

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
for i in range(100):
    if (a * i % b == c):
        print("YES")
        exit()
print("NO")

Submission status: Accepted

Solution code:
import sys
a, b, c = map(int, raw_input().split())
for i in range(1,b+1):
	total = a * i
	if total % b == c:
		print 'YES'
		sys.exit()
print 'NO'

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
found = False
for i in range(1,b+1):
    if (a * i) % b == c:
        found = True
if found :
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

a, b, c = map(int, input().split())
x = gcd(a, b)

print("YES" if c % x == 0 else "NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
s=0
for i in range(1, b+1):
    if (a * i) % b == c:
        s = 1
        break
print("YES" if s else "NO")

Submission status: Accepted

Solution code:
a, b, c = map(int,input().split())

a_mod_b = a % b

flg = False
while a_mod_b > 0:
	a_mod_b = ( a_mod_b + a ) % b
	if a_mod_b == c :
		flg = True
		break
if flg:
	print("YES")
else:
	print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans='NO'
for i in range(10**5):
    if (c+b*i)%a==0:
        ans='YES'
        break
print(ans)

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())

for i in range(b):
  if a % b * i % b == c:
    print("YES")
    exit()
print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
flag=False
for i in range(b):
    if a*i%b==c:
        flag=True
print("YES" if flag else "NO")

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

A_mod = []
i = 1
while 1:
    x = (A*i)%B
    if x in A_mod:
        break
    A_mod.append(x)
    i += 1

A_mod.remove(0)
A_mod = sorted(A_mod)
s = 0
for a in A_mod:
    while s < C:
        s += a

if s == C:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())

ans = 'NO'
for i in range(1,B+1):
    if A * i %  B == C:
        ans = 'YES'
print(ans)

Submission status: Accepted

Solution code:
A, B, C = map(int, input().split())
for i in range(B):
	if A * i % B == C:
		print("YES")
		break
else:
	print("NO")

Submission status: Accepted

Solution code:
A,B,C = map(int, input().split())
ans = 'NO'
for i in range(B):
  if (A*(i+1))%B == C:
    ans = 'YES'
    break
print(ans)

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
ans=0
flag=0
for i in range(b):
  ans+=a
  if(ans%b==c):
    flag=1

if(flag==1):
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

a,b,c=map(int,input().split())
for i in range(a,0,-1):
  if a%i==0 and b%i==0:
    gcd=i
    break
if c%gcd==0:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
a, b, c = map(int, input().split())
for i in range(1000000):
    if (a*i)%b==c:
        print("YES")
        break
else:
    print("NO")

Submission status: Accepted

Solution code:
a,b,c=map(int,input().split())
for i in range(a,0,-1):
  if a%i==0 and b%i==0:
    gcd=i
    break
if c%gcd==0:
  print("YES")
else:
  print("NO")

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
a,b,c = LS()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")
"""
#B
a,b,c = LI()
x = a
f = [0 for i in range(b)]
while 1:
    if a%b == c:
        print("YES")
        quit()
    if f[a%b]:
        print("NO")
        quit()
    f[a%b] = 1
    a += x
#C
""""
n,T = LI()
ans = 0
t = LI()
for i in range(n-1):
    ans += min(T,t[i+1]-t[i])
ans += T
print(ans)
"""

#D
"""
n,w = LI()
g = LIR(n)
l = [[] for i in range(4)]
for W,v in g:
    l[W-g[0][0]].append(v)
    l[W-g[0][0]].sort(reverse = True)
l0 = len(l[0])
l1 = len(l[1])
l2 = len(l[2])
l3 = len(l[3])
for i in range(l0-1):
    l[0][i+1] += l[0][i]
l[0].insert(0,0)
for i in range(l1-1):
    l[1][i+1] += l[1][i]
l[1].insert(0,0)
for i in range(l2-1):
    l[2][i+1] += l[2][i]
l[2].insert(0,0)
for i in range(l3-1):
    l[3][i+1] += l[3][i]
l[3].insert(0,0)
ans = 0
for i in range(l0+1):
    for j in range(l1+1):
        for k in range(l2+1):
            for m in range(l3+1):
                if i*g[0][0]+j*(g[0][0]+1)+k*(g[0][0]+2)+m*(g[0][0]+3) <= w:
                    ans = max(ans,l[0][i]+l[1][j]+l[2][k]+l[3][m])
print(ans)
"""

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T