defext_euclid( a , b ):if (b == 0):
return1, 0, a
else:
x , y , q = ext_euclid( b , a % b )
x , y = y, ( x - (a // b) * y )
return x, y, q
c int gcdEx(int a, int b, int *x, int *y)
{
if(b==0)
{
*x = 1,*y = 0;
return a;
}
else
{
int r = gcdEx(b, a%b, x, y);
int t = *x;
*x = *y;
*y = t - a/b * *y;
return r;
}
}