方程的解(拓展欧几里德)
******************************************* 1 void exgcd(ll a,ll b,ll &x,ll &y) 2 { 3 if(b==0) 4 { 5 x=1;y=0;return ; 6 } 7 exgcd(b,a%b,x,y); 8 ll z=x;x=y;y=z-(a/b)*y; 9 return ; 10 } View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<string> 5 #include<algorithm> 6 #include<cmath> 7 #include<stack> 8 #include<vector> 9 #include<queue> 10 #include<bits/stdc++.h> 11 #define MAXN 401 12 #define ps push_back 13 #define ll long long 14 using namespace std; 15 ll aa,bb,cc; 16 ll T; 17 void exgcd(ll a,ll b,ll &x,ll &y) 18 { 19 if(b==0) 20 { 21 x=1;y=0;return ; 22 } 23