题目: http://www.lydsy.com/JudgeOnline/problem.php?id=1101 题解: http://www.cnblogs.com/mrha/p/8203612.html 数学公式太难打了,核心思想是化成gcd(i,j)==1,然后用莫比乌斯反演变成枚举约数d,然后再搞式子 #include<cstdio> #include<algorithm> #define N 50005 typedef long long ll; using namesp…
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1101 #include<cstdio> #include<cstring> #include<algorithm> #define ll long long using namespace std; ; int T,n,m,D,u[N],pri[N];bool vis[N]; int rdn() { ;;char ch=getchar(); ;ch=getchar…