扩展欧几里德

	int extended_euclidean(int n, int m, int &x, int &y) {
		if (m == 0) {
			x = 1; y = 0; return n;
		}
		int g = extended_euclidean(m, n % m, x, y);
		int t = x - n / m * y;
		x = y;
		y = t;
		return g;
	}	

你可能感兴趣的:(扩展欧几里德)