#include<iostream> #include<cmath> #include<bits/stdc++.h> using namespace std; #define ll long long ll qpow(ll x,ll n,ll mod) { ll res=1; while(n>0) { if(n%2==1) { res*=x; res%=mod; } x*=x; x%=mod; n/=2; } return res; } int main() { ll n,mod=9973,m; int t; cin>>t; while(t--) { cin>>m>>n; cout<<qpow(n,mod-2,mod)*m%mod<<endl; } return 0; }
B - A/B HDU - 快速幂-逆元
猜你喜欢
转载自blog.csdn.net/BePosit/article/details/81937925
今日推荐
周排行