-
-
Save karhunenloeve/632cb2650e08cd179c11f4d25cd73e0a to your computer and use it in GitHub Desktop.
Codeforces Number Theory #Codeforces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def exgcd(a, b): | |
if 0 == b: | |
return 1, 0, a | |
x, y, q = exgcd(b, a % b) | |
x, y = y, (x - a // b * y) | |
return x, y, q | |
def main(): | |
a, b, c = map(int, input().split()) | |
c = -c | |
x, y, q = exgcd(a, b) | |
if c % q == 0: | |
print("%d %d"%(c//q*x, c//q*y)) | |
else: | |
print(-1) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment