标签:des blog http io ar os sp java strong
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2430 Accepted Submission(s): 1760
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<algorithm> #include<queue> #include<cstdlib> #include<vector> #include<set> using namespace std; #define MOD 9973 int t,n,b,ans; void egcd(int a,int b,int &x,int &y) { if(b==0) { x=1; y=0; return ; } else { egcd(b,a%b,x,y); int t=x; x=y; y=t-a/b*y; } } int main() { int x,y; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&b); egcd(b,MOD,x,y); x=n*x; ans=(x%MOD+MOD)%MOD; printf("%d\n",ans); } return 0; }
标签:des blog http io ar os sp java strong
原文地址:http://www.cnblogs.com/a972290869/p/4101133.html