aboutsummaryrefslogtreecommitdiff
path: root/Math
diff options
context:
space:
mode:
authorAnthony Wang2020-08-26 09:11:29 -0500
committerAnthony Wang2020-08-26 09:11:29 -0500
commit2e8cd40360bf6026b302deffb1adb4f5a3a33806 (patch)
tree10150eb7b5746c620a1f7c5de5ff0eb82fcb30f3 /Math
parenta44e1c8029f417d87d89d45d859a22688202c40e (diff)
Cleanup
Diffstat (limited to 'Math')
-rw-r--r--Math/numtheory.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Math/numtheory.cpp b/Math/numtheory.cpp
index 8801426..02228e2 100644
--- a/Math/numtheory.cpp
+++ b/Math/numtheory.cpp
@@ -1,7 +1,5 @@
constexpr ll MOD = 1e9+7;
-ll fact[MN] = { 1 }, ifact[MN] = { 1 };
-
inline ll pw(ll base, ll exp) {
ll res = 1;
while (exp) {
@@ -13,6 +11,8 @@ inline ll pw(ll base, ll exp) {
inline ll inv(ll x) { return pw(x, MOD-2); }
+ll fact[MN] = { 1 }, ifact[MN] = { 1 };
+
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]);