Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def gcd(a, b):
- if b == 0:
- return a
- else:
- return gcd(b, a % b)
- a, b = map(int, input().split())
- if a == 1:
- print(b + 1," -1")
- else:
- if gcd(a,b) != 1:
- print("0 0")
- else:
- i = -10000
- while (b * i) % a != 1:
- i += 1
- n = b * i
- ans = (n - 1) / a
- print(int(-ans), i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement