Fix bug when n<2 and m=1 [closes #24]

This commit is contained in:
Antti H S Laaksonen 2017-03-18 12:20:26 +02:00
parent 7415871dac
commit 5562d7327d
1 changed files with 1 additions and 1 deletions

View File

@ -331,7 +331,7 @@ long long x = 1;
for (int i = 2; i <= n i++) {
x = (x*i)%m;
}
cout << x << "\n";
cout << x%m << "\n";
\end{lstlisting}
Usually the remainder should always