![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
组合数学
阿启呀
这个作者很懒,什么都没留下…
展开
-
UVA 10325 The Lottery 容斥原理
UVA 10325 The Lottery 容斥原理链接:UVA 10325 The Lottery题意:给你两个正整数n,mn,mn,m,然后给你mmm个正整数a1,a2,⋅⋅⋅,ama_1,a_2,···,a_ma1,a2,⋅⋅⋅,am,让你找出111~nnn中有多少个数不是这mmm个数的倍数?题解:显然,我们会想到用nnn减去n/ain/a_in/ai,但是这样会有一些元素会...原创 2019-11-24 22:59:54 · 131 阅读 · 0 评论 -
HDU 5072 Coprime [和睦三元组]容斥原理
HDU 5072链接原创 2019-11-23 15:43:40 · 305 阅读 · 0 评论 -
lightOJ 1161 Extreme GCD(素数四元组)[容斥原理]
Extreme GCD(素数四元组)[容斥原理]链接:lightOJ 1161题意:原创 2019-11-22 20:33:52 · 261 阅读 · 0 评论 -
HDU 4135 容斥原理
HDU 4135 容斥原理链接题意:给你一个区间[a,b][a,b][a,b] ,求这个区间内与n互质的数的个数。题解:可以先求出[1,b][1,b][1,b]内与n互质的数的个数,然后再求出[1,a−1][1,a-1][1,a−1]内与n互质的数的个数,然后用前者减去后者即是答案。前者可以采用容斥原理求。对容斥原理不了解的可以看链接。首先求出n的所有质因子,然后dfs求容斥系数。代码:...原创 2019-11-13 21:09:38 · 189 阅读 · 0 评论 -
Great cells
转载∑g=0N∗MgG(g)\sum_{g=0}^{N*M}{g}G(g)∑g=0N∗MgG(g) 也就是说每一个方案数G(g)G(g)G(g)里面有g个Great cell,每一个Great cell对总结果贡献1。所以,最后就是所有格子作为Great cell的情况的总和∑x=0KN∗M∗(x−1)N+M−2∗K(N−1)(M−1)\sum_{x=0}^{K}N*M*{(x-1)}^{N...原创 2019-10-31 22:06:49 · 141 阅读 · 0 评论 -
Codeforces#533 C.Ayoub and Lost Array(组合数学&递推)
问题Ayoub had an array a of integers of size n and this array had two interesting properties:All the integers in the array were between l and r (inclusive).The sum of all the elements was divisible ...原创 2019-11-13 21:26:04 · 233 阅读 · 0 评论