Lucas定理学习笔记(没有ex_lucas)

题目链接\(Click\) \(Here\)

\(ex\_lucas\)实在是不能学的东西。。。简单学了一下\(Lucas\)然后打算就这样鸽着了\(QwQ\)奶一口不可能考

没什么复杂的,证明的话请看这个博客,我个人也仅仅是简单感性理解了一下。

int lucas (int x, int y) {
    if (x < y) {
        return 0;
    } else if (x < p) {
        return 1LL * fac[x] * inv (fac[y]) * inv (fac[x - y]) % p;
    } else {
        return 1LL * lucas (x / p, y / p) * lucas (x % p, y % p) % p;
    }
}

就是这样~

猜你喜欢

转载自www.cnblogs.com/maomao9173/p/10491800.html