求解一组ax+bc=gcd(a,b) #include<iostream> #include<cstdio> using namespace std; int exgcd(int A,int B,int &x,int &y){ ){ x=;y=;return A; } int ret=exgcd(B,A%B,x,y); int t=x;x=y;y=t-A/B*y; return ret; } int main(){ int a,b,x,y; while(cin>…
逆元模板P1082 #include <cstdio> #include <algorithm> int exgcd(int a, int b, int &x, int &y) { if(!b) { x = ; y = ; return a; } int g = exgcd(b, a % b, x, y); std::swap(x, y); y -= (a / b) * x; return g; } int main() { int a, b; scanf(&quo…