摘要: 对于大组合数对某素数$p$的模,可以使用Lucas定理,程序代码如下: 其中fac[n]表示$n!\mod p$。 理论知识: 对于非负整数$m$和$n$,以及素数$p$,则有下式成立: $\binom{m}{n} \equiv \prod_{i=0}^{k}{\binom{m_i}{n_i}}$, 阅读全文
posted @ 2016-08-05 01:57 astoninfer 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 相关习题: Uva 11637 Garbage Remembering Exam 代码: 1 #include <algorithm> 2 #include <cstdio> 3 #include <cstring> 4 #include <string> 5 #include <queue> 6 阅读全文
posted @ 2016-08-05 00:28 astoninfer 阅读(236) 评论(0) 推荐(0) 编辑