寫一個計算器,能計算
數論雜題。 第一問快速冪,第二問exgcd,第三問BSGS.
#include <cstdio>#include <map>#include <iostream>#include <algorithm>#include <cmath>using namespace std;typedef long long ll;int n,x,y,p,k,a,b;map<int,int> Mp;inline void reaD(int &x){ char Ch=getchar();x=0; for(;Ch>'9'||Ch<'0';Ch=getchar()); for(;Ch>='0'&&Ch<='9';x=x*10+Ch-'0',Ch=getchar());}inline ll solve_1(ll x,int y,int p){ ll k=1;x%=p; while(y){ if(y&1) k=1ll*k*x%p; x=1ll*x*x%p; y>>=1; } //新聞熱點
疑難解答