Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. int extendedEuclid(int a, int b, int &x, int &y) {
  2. int xx = y = 0;
  3. int yy = x = 1;
  4. while (b) {
  5. int q = a / b;
  6. int t = b; b = a % b; a = t;
  7. t = xx; xx = x - q * xx; x = t;
  8. t = yy; yy = y - q * yy; y = t;
  9. }
  10. return a;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement