
莫比乌斯反演
zz_ylolita
这个作者很懒,什么都没留下…
展开
-
luogu2257 YY的GCD——莫比乌斯反演
注意一下处理前缀和的时候的trick #include <bits/stdc++.h> using namespace std; #define N 10000005 bool vis[N]; int miu[N]; typedef long long LL; LL sum[N],ans,g[N]; int prime[N]; int cnt,T,n,m; void Miu() {...原创 2018-09-23 16:03:00 · 199 阅读 · 0 评论 -
luogu3455 [POI2007]ZAP-Queries——莫比乌斯反演
比上一题更简单。。。 #include <bits/stdc++.h> using namespace std; #define N 50005 bool vis[N]; int miu[N],prime[N]; typedef long long LL; LL sum[N],ans; int n,m,d,T,cnt; void Miu() { miu[1] = 1; cnt ...原创 2018-09-23 16:27:29 · 215 阅读 · 0 评论 -
luogu2522[HAOI2011]Problem b
用一个简单的容斥就可以求出a<=x <=b, c<=y<=d范围的答案了 注意1LL呀qwq #include <bits/stdc++.h> using namespace std; #define N 50005 bool vis[N]; int miu[N],prime[N]; typedef long long LL; LL sum[N],ans;...原创 2018-09-23 16:42:40 · 141 阅读 · 0 评论 -
luogu1829 [国家集训队]Crash的数字表格 / JZPTAB
式子好难推。。看别人的博客好了。。 #include <bits/stdc++.h> using namespace std; #define N 10000005 #define P 20101009 bool vis[N]; int prime[N],miu[N]; typedef long long LL; LL x[N], ans; int cnt,n,m; void ...原创 2018-09-23 18:10:33 · 243 阅读 · 0 评论 -
bzoj4659LCM
总感觉我的做法是假的莫比乌斯反演。。 只用到了莫比乌斯函数的性质 复杂度是O(nlogn)的,这题正好p是2^30可以用int自然溢出,不用取模,但是最后的答案还是要+p在%p,防止是负数 #include <bits/stdc++.h> using namespace std; const int P = 1<<30; #define N 4000005 int ...原创 2018-09-23 20:49:49 · 181 阅读 · 0 评论