标签:code == div logs ring style turn main can
ex_gcd:
1 #include<stdio.h> 2 #include<string.h> 3 using namespace std; 4 int x,y; 5 int ex_gcd(int a,int b,int &x,int &y) 6 { 7 if(b==0) 8 { 9 x=1; 10 y=0; 11 return a; 12 } 13 int ans=ex_gcd(b,a%b,x,y); 14 int tmp=x; 15 x=y; 16 y=tmp-a/b*y; 17 return ans; 18 } 19 int main() 20 { 21 int a,b; 22 while(~scanf("%d%d",&a,&b)) 23 { 24 ex_gcd(a,b,x,y); 25 printf("%d %d\n",x,y); 26 } 27 }
标签:code == div logs ring style turn main can
原文地址:http://www.cnblogs.com/ECJTUACM-873284962/p/6562196.html