逆元打表模板:
long long re[N],inv[N],fac[N]; void init(int n){ re[0] = inv[1] = fac[0] = 1; for(int i = 1;i <= n;++i) fac[i] = fac[i-1] * i % mod; for(int i = 2;i <= n;++i) inv[i] = (mod-mod/i)*inv[mod%i] % mod; for(int i = 1;i <= n;++i) re[i] = re[i-1] * inv[i] % mod; } long long c(int a,int b){ if(a < 0) return 0; return fac[a]*re[b]%mod*re[a-b]%mod; }