快速幂取余

快速模乘 a*b%p

int mul(int a,int b)
{
 int r=0;
 while(b)
 {
  if(b&1) r=(r+a)%p;
  a=(a<<1)%p;
  b>>=1;
 }
 return r;
}
0

Leave a Reply

Your email address will not be published.