Redirecting to

Linear Diophantine Equation

You have been given three Integers a, b and k. you need to find an integral solution of x and y such that a*x + b*y= k * gcd(a,b). 

It can be proven that solution always exist.
Input Format
The first line contains 3 integer a, b and k.
Output Format
output integral value of x and y in a single line.
Question Video
1 <= a, b, k <= 10^6
Sample Input
3 5 8
Sample Output
16 -8

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name