
积性函数
Gzb1128
保持你的决心
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[杜教筛]小结
你问我是参考哪里的,我只能回答无可奉告 http://blog.youkuaiyun.com/skywalkert/article/details/50500009 这篇博客如果和tangls的博客有雷同之处,并非偶然 通常我们用艾拉筛,nlogn,通常跑很快。 但是随着oi的发展,我们用到了线性筛,On,跑的更快。 当你以为On筛能解决所有事情时,出题人已经开始使用O(n23)O(n23)O(n^...原创 2017-03-16 20:49:06 · 673 阅读 · 1 评论 -
[51nod][数论][积性函数]欧拉函数之和
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1239 sol: 简单杜教筛 #include<iostream> #include<string> #include<cstring> #include<algorithm> #include<cstdi...原创 2018-03-19 19:28:51 · 576 阅读 · 0 评论 -
[51nod][积性函数]莫比乌斯函数之和
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1244 sol: 简单杜教筛 #include<iostream> #include<string> #include<cstring> #include<algorithm> #include<cstdio&...原创 2018-03-19 19:29:50 · 224 阅读 · 0 评论 -
[hdu5608][积性函数]function
http://acm.hdu.edu.cn/showproblem.php?pid=5608 sol: 简单杜教筛 设g(n)=n^2-3n+2,s(n)=∑nif(i)∑inf(i)\sum_i^n f(i) g=f∗1g=f∗1g=f*1 g∗μ=f∗1∗μ=f∗eg∗μ=f∗1∗μ=f∗eg*\mu=f*1*\mu=f*e f(n)=∑d|ng(d)μ(nd)∑d|ng(d)μ(...原创 2018-03-19 20:03:37 · 249 阅读 · 0 评论 -
[51nod][积性函数][杜教筛]最小公倍数之和 V3
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1238 sol: https://www.cnblogs.com/Blue233333/p/8320009.html 比较套路就不推了(虽然我做了2天) 具体可以见我杜教筛小结的那个博客,套路题 就是化到求i^2phi(i)的前缀和的时候卷一下id^2,就是个很好...原创 2018-03-22 10:05:01 · 187 阅读 · 0 评论 -
[51nod][积性函数][杜教筛]最大公约数之和 V3
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1237 sol: 本来已经不想做裸题了,但是之前的题总是要调一下才能过,就很不优美 这题终于一遍过了,感觉差不多把调试的坑点给找完了。 杜教筛的精髓似乎也掌握到一点了。 简单反演 ∑ndd∑ndi∑ndj(i,j)=1∑dnd∑ind∑jnd(i,j)=1\su...原创 2018-03-22 11:23:28 · 280 阅读 · 0 评论 -
[积性函数]DIVCNT2 - Counting Divisors (square)
http://www.spoj.com/problems/DIVCNT2/ sol: 考虑到i^2这个东西有点恶心 w(x)表示x的不同的质因子个数 ∑d|i21=∑d|i2w(d)∑d|i21=∑d|i2w(d)\sum_{d|i^2}1=\sum_{d|i}2^{w(d)}实际上就是i的所有约数的质因子的幂是否加上i的对应质因子的幂,这样就成为了i^2的约数了。 考虑到2w(d...原创 2018-04-10 16:16:45 · 255 阅读 · 0 评论