diff options
author | Anthony Wang | 2020-08-21 10:46:06 -0500 |
---|---|---|
committer | Anthony Wang | 2020-08-21 10:46:06 -0500 |
commit | 29eb7792ce4e2b3f56286e1b145be06b2e2b341a (patch) | |
tree | ee9ead4c9c083cc180a7468be26b53dcd167fcbc | |
parent | 2cf68f94b84ab3e19d6440bc4fb1b933bef46bfe (diff) |
Inline functions
-rw-r--r-- | Math/numtheory.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Math/numtheory.cpp b/Math/numtheory.cpp index 3396a0e..51faffb 100644 --- a/Math/numtheory.cpp +++ b/Math/numtheory.cpp @@ -2,7 +2,7 @@ constexpr ll MOD = 1e9+7; ll fact[200002] = { 1 }, ifact[200002] = { 1 }; -ll pw(ll base, ll exp) { +inline ll pw(ll base, ll exp) { ll res = 1; while (exp) { if (exp & 1) (res *= base) %= MOD; @@ -11,11 +11,11 @@ ll pw(ll base, ll exp) { return res; } -ll inv(ll x) { return pw(x, MOD - 2); } +inline ll inv(ll x) { return pw(x, MOD - 2); } -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]); -}
\ No newline at end of file +} |