之前总是上网查,还查不到完整的,有点浪费时间,还是得背过
ll powmod(ll a, ll n)
{
ll res = 1;
while(n)
{
if(n & 1) res = res * a % mod;
n >>= 1;
a = a * a % mod;
}
return res;
}
void init()
{
fac[0] = 1;
for(int i = 1; i < maxn; i++) fac[i] = fac[i - 1] * i % mod, inv[i] = powmod(fac[i], mod - 2);
}
ll c(ll n, ll m)
{
if(m == 0 || m == n) return 1;
return fac[n] * inv[m] % mod * inv[n - m] % mod;
}