aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2020-08-24 09:41:18 -0500
committerAnthony Wang2020-08-24 09:41:18 -0500
commite0526ad005a6e7aa40290e93ce5c1f320bb97a0b (patch)
tree012f8dd248b740476f385a661c481a3ff8cddeba
parent4477e06f4e411efc82f95c6b87372072c41a9925 (diff)
Update numtheory.cpp
-rw-r--r--Math/numtheory.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/Math/numtheory.cpp b/Math/numtheory.cpp
index 7a02afc..8801426 100644
--- a/Math/numtheory.cpp
+++ b/Math/numtheory.cpp
@@ -11,11 +11,8 @@ inline ll pw(ll base, ll exp) {
return res;
}
-inline ll inv(ll x) { return pw(x, MOD - 2); }
+inline ll inv(ll x) { return pw(x, MOD-2); }
-inline ll nCr(int n, int k) { return fact[n] * ifact[k] % MOD * ifact[n - k] % MOD; }
+inline ll nCr(int n, int k) { return fact[n]*ifact[k]%MOD*ifact[n-k]%MOD; }
-for (int i = 0; i < N; ++i) {
- fact[i + 1] = (i + 1ll) * fact[i] % MOD;
- ifact[i + 1] = inv(fact[i + 1]);
-}
+for (int i = 0; i < N; ++i) fact[i+1] = (i+1ll)*fact[i]%MOD, ifact[i+1] = inv(fact[i+1]);