题解:EXBSGS裸题.代码:#include#include#include#include#include#include#include#includeusing namespace std;
typedef long long ll;
inline ll gcd(ll a,ll b){
return(!b)?a:gcd(b,a%b);
}
inline ll pow(ll x,ll y,ll p){
ll re=1,t=x;
for(;y;y>>=1,t=t*t%p)
if(y&1)
re=re*t%p;
return re;
}
inline void exgcd(ll a,ll b,ll&d;,ll&x;,ll&y;){
if(!b){
d=a;
x=1;
y=0;
}
else{
exgcd(b,a%b,d,y,x);
y-=x*(a/b);
}
}
inline ll inv(ll a,ll p){
ll d,x,y;
exgcd(a,p,d,x,y);
x=(x%p+p)%p;
return x;
}
struct Ha
...
继续阅读
(87)