Fix modpow data type [closes #55]

This commit is contained in:
Antti H S Laaksonen 2017-10-15 14:55:34 +03:00
parent 64e7fab904
commit dad48aca8f
1 changed files with 1 additions and 1 deletions

View File

@ -432,7 +432,7 @@ $x^n \bmod m$:
\begin{lstlisting} \begin{lstlisting}
int modpow(int x, int n, int m) { int modpow(int x, int n, int m) {
if (n == 0) return 1%m; if (n == 0) return 1%m;
int u = modpow(x,n/2,m); long long u = modpow(x,n/2,m);
u = (u*u)%m; u = (u*u)%m;
if (n%2 == 1) u = (u*x)%m; if (n%2 == 1) u = (u*x)%m;
return u; return u;