快速幂模板~

typedef long long ll;
ll pow(ll x,ll n,ll mod)
{
    ll ans=1;
	while(n)
	{
	   if(n&1)	
	   {
			res=(res*x)%mod;
			n--;
	   }
	   x=(x*x)%mod;
	   n>>=1;
	}
	return res;	
}

猜你喜欢

转载自blog.csdn.net/yu121380/article/details/81143362