标签:style blog color io div 算法 amp log
#include<stdio.h> int extended_gcd(int a,int b,int &x,int &y) { int r,t; if(!b) { x = 1; y = 0; return a; } r = extended_gcd(b,a%b,x,y); t = x; x = y; y = t-a/b*y; return r; } int main() { int a,b,x,y,z; scanf("%d%d",&a,&b); z = extended_gcd(a,b,x,y); printf("%d%d%d\n",z,x,y); return 0; }
扩展欧几里德算法—求解不定方程,线性同余方程,布布扣,bubuko.com
标签:style blog color io div 算法 amp log
原文地址:http://www.cnblogs.com/yangyongqian/p/3894055.html