diff options
| author | MZuenni <michi.zuendorf@gmail.com> | 2024-06-28 13:47:18 +0200 |
|---|---|---|
| committer | MZuenni <michi.zuendorf@gmail.com> | 2024-06-28 13:47:18 +0200 |
| commit | 65d2ac37862ce9d1de208a05099c281863e66256 (patch) | |
| tree | d1fe1ece8790e8e8b2a8bcd3895f82477b3a0e2b /math/multInv.cpp | |
| parent | a3c9198048cf465a3c01827b3667edfc99d8031c (diff) | |
| parent | 366ff0a4ba0c94f5cdc2cbd4e2c991ad0b544522 (diff) | |
merge
Diffstat (limited to 'math/multInv.cpp')
| -rw-r--r-- | math/multInv.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/math/multInv.cpp b/math/multInv.cpp index 87603f3..647dc2d 100644 --- a/math/multInv.cpp +++ b/math/multInv.cpp @@ -1,5 +1,4 @@ -ll multInv(ll n, ll p) { - ll x, y; - extendedEuclid(n, p, x, y); // Implementierung von oben. - return ((x % p) + p) % p; +ll multInv(ll x, ll m) { + auto [d, a, b] = extendedEuclid(x, m); // Implementierung von oben. + return ((a % m) + m) % m; } |
