组合数
须搭配模数使用。
struct Binom {
std::vector<Mint> fact, ifact;
Binom(int n): fact(n + 1), ifact(n + 1){
fact[0] = 1;
for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
ifact[n] = fact[n].inv();
for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
}
Mint operator()(int n, int m) {return 0 <= m && m <= n ? fact[n] * ifact[m] * ifact[n - m] : 0; }
};