// 需要先预处理出fact[],即阶乘 inline ll C(ll m, ll n, ll p) { return m < n ? 0 : fact[m] * inv(fact[n], p) % p * inv(fact[m - n], p) % p; } inline ll lucas(ll m, ll n, ll p) { return n == 0 ? 1 % p : lucas(m / p, n / p, p) * C(m % p, n % p, p) % p; }View Code
标签:ll,return,Lucas,inv,inline,定理,fact From: https://www.cnblogs.com/Lamboofhome/p/17294300.html