题意:给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对 1<=N<=10^7 思路:莫比乌斯反演,同BZOJ2820…… ; ..max]of int64; prime,flag,f,mu:..max]of longint; n,m,i,j,t,v,cas:longint; function clac(n:longint):int64; var x,i,pos:longint; begin clac:=; i:=; while i<=n do…
就是之前的2820的升级版. 把暴力枚举素数改成预处理就随便A了. #include<bits/stdc++.h> #define N 10000005 #define ll long long using namespace std; int mu[N],vis[N],prime[N],cnt; long long f[N]; void calcmu(){ cnt=;mu[]=; memset(f,,sizeof(f)); memset(vis,true,sizeof(vis)); ;i&l…