[POI2007] ZAP-Queries 题目描述 Byteasar the Cryptographer works on breaking the code of BSA (Byteotian Security Agency). He has alreadyfound out that whilst deciphering a message he will have to answer multiple queries of the form"for givenintegers aa, b…
题目: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…
[Luogu3455][POI2007]ZAP-Queries(莫比乌斯反演) 题面 题目描述 FGD正在破解一段密码,他需要回答很多类似的问题:对于给定的整数a,b和d,有多少正整数对x,y,满足x<=a,y<=b,并且gcd(x,y)=d.作为FGD的同学,FGD希望得到你的帮助. 输入输出格式 输入格式: The first line of the standard input contains one integer nn (1\le n\le 50 0001≤n≤50 000),de…
题目: 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…