@chawuciren
2019-09-21T16:02:14.000000Z
字数 190
阅读 534
CINTA
/*
* Input: three integers:x,y and m
* Output: (x^y)%m
* Method: iterative method
*/
int ModulusIndex(int x,int y,int m){
int res=1;
while(y){
if(y&1){
res=res*x%m;
}
x=x*x%m;
y=y>>1;
}
return res;
}