标签:code style turn int gcd amp tmp color 不定方程
求解二元一次不定方程 mx + ny = gcd(m, n)
1 int ex_gcd(int m, int n, int &x, int &y) 2 { 3 if (n == 0) { 4 x = 1; 5 y = 0; 6 return m; 7 } 8 int tmp, g; 9 g = ex_gcd(n, m % n, x, y); 10 tmp = x; 11 x = y; 12 y = tmp - m / n * y; 13 return g; 14 }
标签:code style turn int gcd amp tmp color 不定方程
原文地址:http://www.cnblogs.com/ghcred/p/7436727.html