摘要:
这题用扩展的欧几里得算法#include<iostream>using namespace std;void gcd(int a,int b,int &x,int &y){ if(b==0) { x=1;y=0; } else { gcd(b,a%b,x,y); int t=x; x=y; y=t-a/b*y; }}int main(){ int T,x,y; int n,m; cin>>T; while(T--) { scanf("%d%d",&n,&m); gcd(m,9973,x,y); x*=n; printf 阅读全文