Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def gcd_ext(first_num, second_num):
- if second_num == 0:
- return first_num, 1, 0
- d, x, y = gcd_ext(second_num, first_num % second_num)
- x, y = y, x - (first_num // second_num) * y
- return d, x, y
- a, b, c = map(int, input().split())
- d, x, y = gcd_ext(a, b)
- if c % d != 0:
- print(-1)
- else:
- x *= c // d
- y *= c // d
- change = x // b
- print(x - change * b, y + change * a)
Advertisement
Add Comment
Please, Sign In to add comment