求逆元

LL qpow(LL x,LL y){
	LL ans = 1;
	for(;y;y>>=1){
		if(y&1) ans = (ans*x)%mod;
		x = (x*x)%mod;
	}
	return ans%mod;
}

LL inv(LL x,LL y){ // x/y;
	return  ( (x%mod)*qpow(y,mod-2)%mod )%mod;
}
posted @ 2021-05-11 13:38  棉被sunlie  阅读(50)  评论(0)    收藏  举报