
容斥
protecteyesight
我向往天空的湛蓝和一望无际。保护视力,只为看到更远的天空。
展开
-
ICPC乌鲁木齐赛后感悟
最后一次比赛了,虽然打铁了,但是并不可惜,三人都尽了全力,坚持到了比赛的最后一刻,每个人都在为了这个团队付出,这才是比赛的意义所在。2017新疆乌鲁木齐icpc题目偏向数学,数学题好几道。B和G是两个签到题,看手速。D题正解是推出一个组合数的式子,我们用的是矩阵快速幂(全场过这题的估计没几个用这个的)。队友找的是三层的递推关系,我构造了6*6的矩阵,一切顺风顺水敲出了代码,但是前期一直原创 2017-12-04 21:23:40 · 391 阅读 · 4 评论 -
NEFU 163 Co-prime(质数分解+容斥)
DescriptionGiven a number N, you are asked to count the number of integers between A and Binclusive which are relatively prime to N.Two integers are said to be co-prime or relatively prime if原创 2017-10-11 17:56:28 · 372 阅读 · 0 评论 -
HDU 4059 The Boss on Mars(质数分解+容斥)
题目自行搜索题意:给你一个数n,求小于n并且与n互质的所有数的4次方之和。分析:n的数据量达到1e8,O(n)的复杂度都悬,由此想到因数分解O(sqrt(n))。那么把一个数因数分解之后,是一个 若干质数的若干次幂相乘的形式,那么对这个分解式的每一个质数来说,如果某个小于n的数是某个质因数的倍数的话,那么这个小于n的数就不是答案里出现的数,那么对于分解出的每个质因数都要遍历,只原创 2017-10-07 17:54:21 · 312 阅读 · 0 评论 -
HDU Frogs 5514 容斥
There are mm stones lying on a circle, and nn frogs are jumping over them. The stones are numbered from 00 to m−1m−1 and the frogs are numbered from 11 to nn. The ii-th frog can jump over原创 2017-06-16 11:07:40 · 297 阅读 · 0 评论 -
HDU 4407 SUM
A - SumTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 4407DescriptionXXX is puzzled with the question below: 1, 2, 3原创 2016-11-23 17:35:26 · 488 阅读 · 0 评论 -
hdu 5072 Coprime
DescriptionThere are n people standing in a line. Each of them has a unique id number. Now the Ragnarok is coming. We should choose 3 people to defend the evil. As a group, the 3 people should原创 2016-11-22 17:46:08 · 247 阅读 · 0 评论