洛谷题目传送门 分数其实就是一个幌子,实际上就是求互质数对的个数(除开一个特例\((1,1)\)).因为保证了\(a<b\),所以我们把要求的东西拆开看,不就是\(\sum_{i=2}^n\phi(i)\)吗? 关于通过筛素数线性求欧拉函数的一点思路总结在蒟蒻的blog里 剩下的就是记一个前缀和了. #include<cstdio> #define R register const int N=1000001; int pr[N],phi[N]; long long ans[N]; bo…
Farey Sequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14291 Accepted: 5647 Description The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 < a < b <= n and gcd(a,b)…
题目大意: 给定m n p 求下式 题解:https://blog.csdn.net/codeswarrior/article/details/81700226 莫比乌斯讲解:https://www.cnblogs.com/peng-ym/p/8647856.html 莫比乌斯的mu[]:https://www.cnblogs.com/cjyyb/p/7953803.html #include <bits/stdc++.h> using namespace std; #define LL…