快速幂模板

int qpow(int a,int n){
	int res=1;
	while(n){
		if(n & 1){
			res=res*a%mod;
		}		
		a=a*a%mod;		
		n>>=1;		 
	}
	return res;
}
posted @ 2025-04-13 14:18  Crab2016  阅读(23)  评论(0)    收藏  举报