其实这个用的是Mobius反演的第二种形式 F(d) = (n div d) * (m div d) f(d) = [ gcd(i,j)=d ] (i in [1,a], j in [1,b]) /************************************************************** Problem: 1101 User: idy002 Language: C++ Result: Accepted Time:6764 ms Memory:1688 kb **…
题目: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…
题目: 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> using namespace std; typedef long long ll; ; int pri[xn],cnt,mu[xn]; bool vis[xn]; int rd() { ,f=; char ch=ge…