题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3309 凭着上课所讲和与 Narh 讨论推出式子来: 竟然是第一次写数论分块!所以迷惑了半天: 在预处理的筛中也犯了愚蠢的错误...总之全仰仗 Narh 提点了... 所以具体题解就看这里咯:https://www.cnblogs.com/Narh/p/9740786.html 代码如下: #include<iostream> #include<cstdio> #include…
DZY Loves Math Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 1303  Solved: 819[Submit][Status][Discuss] Description 对于正整数n,定义f(n)为n所含质因子的最大幂指数.例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0.给定正整数a,b,求sigma(sigma(f(gcd(i,j)))) (i=1..a, j=1..b).…
枚举$d=gcd(i,j)$ 然后大力反演 ——来自Popoqqq的博客. 然后大力讨论后面的函数的意义即可. http://blog.csdn.net/popoqqq/article/details/42122413 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define F(i,j,k) for (…
题意:\(f(n)\)为n的质因子分解中的最大幂指数,求\(\sum_{i=1}^n \sum_{j=1}^m f(gcd(i,j))\) 套路推♂倒 \[ \sum_{D=1}^n \sum_{d|D} f(d)\mu(\frac{D}{d}) \frac{n}{D} \frac{m}{D} \] 这次函数是\(g = (f*\mu )\),\(f\)显然不是积性函数,但我们照样可以用线性筛 具体做法我晚上回家再补吧草稿纸忘带了... 补: \(g(p^a)=p-(p-1)\) 因为卷了\(\…
有一个神奇的技巧——打表 code: #include <bits/stdc++.h> #define N 10000007 #define ll long long #define setIO(s) freopen(s".in","r",stdin) using namespace std; int cnt; int vis[N],prime[N],g[N],mu[N],nump[N],minp[N],qp[N]; void Initialize()…
3309: DZY Loves Math Description 对于正整数n,定义f(n)为n所含质因子的最大幂指数.例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0. 给定正整数a,b,求sigma(sigma(f(gcd(i,j)))) (i=1..a, j=1..b). Input 第一行一个数T,表示询问数. 接下来T行,每行两个数a,b,表示一个询问. Output 对于每一个询问,输出一行一个非负整数作为回答. Sample In…
题链: http://www.lydsy.com/JudgeOnline/problem.php?id=3309 题解: 莫比乌斯反演,线筛 化一化式子: f(x)表示x的质因子分解中的最大幂指数 $\sum_{i=1}^n \sum_{j=1}^m f(gcd(i,j))$ $\quad\quad=\sum_{g=1}^{n}f(g)\sum_{d=1}^{\lfloor \frac{n}{g} \rfloor} \mu(d)\lfloor \frac{n}{gd} \rfloor\lfloo…
[BZOJ 2820] YY的gcd(莫比乌斯反演+数论分块) 题面 给定N, M,求\(1\leq x\leq N, 1\leq y\leq M\)且gcd(x, y)为质数的(x, y)有多少对.q组询问 分析 我们要求的是 \[\sum_{p \in P} \sum_{i=1}^n \sum_{j=1}^m [gcd(i,j)=p]\](大写P表示质数集合) 根据\(kgcd(i,j)=gcd(ki,kj)\), \[原式=\sum_{p \in P} \sum_{i=1}^{\lfloo…
3309: DZY Loves Math Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 761  Solved: 401[Submit][Status][Discuss] Description 对于正整数n,定义f(n)为n所含质因子的最大幂指数.例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0.给定正整数a,b,求sigma(sigma(f(gcd(i,j)))) (i=1..a, j=1.…
[BZOJ3309]DZY Loves Math Description 对于正整数n,定义f(n)为n所含质因子的最大幂指数.例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0.给定正整数a,b,求sigma(sigma(f(gcd(i,j)))) (i=1..a, j=1..b). Input 第一行一个数T,表示询问数.接下来T行,每行两个数a,b,表示一个询问. Output 对于每一个询问,输出一行一个非负整数作为回答. Sample…