快速乘

#define LL long long
LL qmul(LL a,LL b,LL mod){
	LL ans = 0;
	for(;b;b>>=1){
		if(b&1) ans = (ans+a)%mod;
		a = a*2%mod;
	}
	return ans;
}
posted @ 2020-06-11 15:34  棉被sunlie  阅读(62)  评论(0)    收藏  举报