求组合数,数字较小,可以预处理阶乘
公式: C(n,m) = n! / (m! * (n-m)!)
依据:
a/(b*c) = a * poww(b,mod,mod-2) % mod * poww(c,mod,mod-2) % mod;
代码块 求C(n,m) const ll mod = 998244353; ll jc[maxx]; void init() { jc[0] = 1; for (int i = 1; i < maxx; i++) jc[i] = i * jc[i - 1] % mod; } ll C(ll n, ll m) { return jc[n] * poww(jc[n - m], mod - 2, mod) % mod * poww(jc[m], mod - 2, mod) %mod; }