数论-二分快速幂(Montgomery 算法)模板

返回 a^b mod c 的值

 1 int Mont(int a, int b, int c)
 2 {
 3     int t = 1;
 4     a %= c;
 5     while (b) {
 6         if (b & 1) t = t * a % c;
 7         b >>= 1, a = a * a % c;
 8     }
 9     return t;
10 }
原文地址:https://www.cnblogs.com/ghcred/p/7436732.html