Demo entry 6770674



Submitted by 反对法 on Nov 14, 2018 at 10:21
Language: C++. Code size: 227 Bytes.

// 快速幂 计算 x^a % P 
LL Power_Mod(LL x,LL a,LL P)
   	if(a==0)return 1;
   	if(a==1)return x;
   	LL res=Power_Mod(x,a/2,P);// 记k=a/2
   	if(a&1)res=res*x%P;// 如果a=2*k+1
    return res;

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).