summaryrefslogtreecommitdiff
path: root/math/multInv.cpp
diff options
context:
space:
mode:
authorPaul Jungeblut <paul.jungeblut@gmail.com>2017-07-10 16:44:39 +0200
committerPaul Jungeblut <paul.jungeblut@gmail.com>2017-07-10 16:44:39 +0200
commite9fcd01ba01b8ad5db5c72d678a0682bd15334e5 (patch)
tree57567b073080a525021bccdfdf6878b69445e1fe /math/multInv.cpp
parent46b25f88e862a320db09e4d964bc9326ab37af78 (diff)
Adding code to count the number of inversions.
Diffstat (limited to 'math/multInv.cpp')
-rw-r--r--math/multInv.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/math/multInv.cpp b/math/multInv.cpp
index 2aedcd6..4e388b8 100644
--- a/math/multInv.cpp
+++ b/math/multInv.cpp
@@ -2,6 +2,6 @@
ll multInv(ll n, ll p) {
ll x, y;
extendedEuclid(n, p, x, y); // Implementierung von oben.
- x += ((x / p) + 1) * p;
+ x = ((x % p) + p) % p;
return x % p;
}