diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-17 16:32:46 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-17 16:32:46 +0100 |
| commit | 3c174f527d8b16e84b3aaaf7b448469bb9682566 (patch) | |
| tree | 8657f530c458f860a5dcf0242fa1b331054c82b1 /content/math/shortModInv.cpp | |
| parent | 05b8f5e35cc5604f872ea937364f107375a1fd89 (diff) | |
allow multInv(x, m) with x >= m
Diffstat (limited to 'content/math/shortModInv.cpp')
| -rw-r--r-- | content/math/shortModInv.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/content/math/shortModInv.cpp b/content/math/shortModInv.cpp index cf91ca0..7d3002c 100644 --- a/content/math/shortModInv.cpp +++ b/content/math/shortModInv.cpp @@ -1,3 +1,3 @@ ll multInv(ll x, ll m) { // x^{-1} mod m - return 1 < x ? m - multInv(m % x, x) * m / x : 1; + return 1 < (x %= m) ? m - multInv(m, x) * m / x : 1; } |
