aboutsummaryrefslogtreecommitdiff
path: root/Math/numtheory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Math/numtheory.cpp')
-rw-r--r--Math/numtheory.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Math/numtheory.cpp b/Math/numtheory.cpp
index 02228e2..a2be7db 100644
--- a/Math/numtheory.cpp
+++ b/Math/numtheory.cpp
@@ -1,5 +1,6 @@
constexpr ll MOD = 1e9+7;
+
inline ll pw(ll base, ll exp) {
ll res = 1;
while (exp) {
@@ -15,4 +16,5 @@ 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]);