Implementation
Time Complexity:
C++
#include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAXN = 2e5 + 1;const int MOD = 1e9 + 7;ll fac[MAXN + 1];ll inv[MAXN + 1];
Python
MAXN = 200000 + 1MOD = 10**9 + 7fac = [0] * (MAXN + 1)inv = [0] * (MAXN + 1)Code Snippet: Combinatorics Functions (from the module) (Click to expand)factorial()inverses()
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!