
组合数
Error Man
我是菜逼
展开
-
组合数打表 模版
//组合数打表模板,适用于N<=3000//c[i][j]表示从i个中选j个的选法。long long C[N][N];void table_C(int maxn) { C[0][0] = 1; for(int i = 1; i <= maxn; i++) { C[i][0] = 1; for(int j = 1; j <...原创 2018-08-26 18:56:24 · 309 阅读 · 0 评论 -
Gym - 101864E E - Diverse Group(费马小定理求乘法逆元 求 组合数 取模 + 快速幂)
E - Diverse GroupIt’s the year 3018 and you are the head of the Bioinformation Articulation in Cosmic Space (BACS) program at NASA. Under this program, NASA has decided to send K humans to planet Na...原创 2018-08-14 12:37:51 · 297 阅读 · 0 评论 -
FZU 2282 K - Wand (费马小定理乘法逆元求组合数取模 + 交错排列数)
K - WandN wizards are attending a meeting. Everyone has his own magic wand. N magic wands was put in a line, numbered from 1 to n(Wand_i owned by wizard_i). After the meeting, n wizards will take a ...原创 2018-08-20 17:04:45 · 282 阅读 · 0 评论 -
乘法逆元 求组合数取模 (模为质数)
为什么求组合数取模,可以用 乘法逆元来做。所以求 组合数取模 就是求 % mod.对于正整数和 p,如果有 ,那么把这个同余方程中的最小正整数解叫做 a 模 p 的逆元。即如果% p = 1, 那么x的最小正整数解就是 a 的逆元。可以得到 % M () % M; //费马小定理所以% M =(% M )% M.ty...转载 2018-08-14 00:21:56 · 704 阅读 · 0 评论 -
Codeforces 224E.Partial Sums(组合数学+费马小定理,重复 k 次前缀和)
E.Partial SumsYou've got an arraya, consisting ofnintegers. The array elements are indexed from 1 ton. Let's determine a two step operation like that:First we build by the arrayaan arrayso...原创 2019-08-03 20:09:40 · 434 阅读 · 0 评论