bzoj 3853 : GCD Array】的更多相关文章

搬运题解Claris:1 n d v相当于给$a[x]+=v[\gcd(x,n)=d]$ $\begin{eqnarray*}&&v[\gcd(x,n)=d]\\&=&v[\gcd(\frac{x}{d},\frac{n}{d})=1]\\&=&v\sum_{k|\gcd(\frac{x}{d},\frac{n}{d})}\mu(k)\\&=&\sum_{k|\frac{n}{d},dk|x}v\mu(k)\end{eqnarray*}$设…
GCD Array Time Limit: 11000/5500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 843    Accepted Submission(s): 205 Problem Description Teacher Mai finds that many problems about arithmetic function can be reduced to…
bzoj[2818]Gcd Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input 一个整数N Output 如题 Sample Input 4 Sample Output 4 HINT hint对于样例(2,2),(2,4),(3,3),(4,2) 1<=N<=10^7 题解一(自己yy) phi[i]表示与x互质的数的个数 即gcd(x,y)=1 1<=y<x ∴对于x,y 若a为素数 则gcd(xa,…
2818: Gcd Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 4436  Solved: 1957[Submit][Status][Discuss] Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. 1<=N<=10^7 uva上做过gcd(x,y)=1的题 gcd(x,y)=p ---> gcd(x/p,y/p)=1 每个质数做一遍行了 答案是欧拉函数的前缀和*2…
2818: Gcd Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 4443  Solved: 1960[Submit][Status][Discuss] Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input 一个整数N Output 如题 Sample Input 4 Sample Output 4 HINT hint对于样例(2,2),(2,4),(3,3),(4,2) 1&l…
1 n d v相当于给$a[x]+=v[\gcd(x,n)=d]$ \[\begin{eqnarray*}&&v[\gcd(x,n)=d]\\&=&v[\gcd(\frac{x}{d},\frac{n}{d})=1]\\&=&v\sum_{k|\gcd(\frac{x}{d},\frac{n}{d})}\mu(k)\\&=&\sum_{k|\frac{n}{d},dk|x}v\mu(k)\end{eqnarray*}\] 设$a[i]=\su…
2818: Gcd Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 1566  Solved: 691[Submit][Status] Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input 一个整数N Output 如题 Sample Input 4 Sample Output 4 HINT hint 对于样例(2,2),(2,4),(3,3),(4,2) 1<=N<=…
2818: Gcd Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 1633  Solved: 724[Submit][Status] Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input 一个整数N Output 如题 Sample Input 4 Sample Output 4 HINT hint 对于样例(2,2),(2,4),(3,3),(4,2) 1<=N<=…
2818: Gcd Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 3241  Solved: 1437[Submit][Status][Discuss] Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对. Input 一个整数N Output 如题 Sample Input 4 Sample Output 4 HINT hint 对于样例(2,2),(2,4),(3,3),(4,2) 1&…
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=37161 题意:gcd(x, y) = 质数, 1 <= x, y <= n的对数 思路:显然gcd(x, y) = k, 1 <= x, y <= n的对数等于求(x, y) = 1, 1 <= x, y <= n/k的对数.所以,枚举每个质数p,然后求gcd(x, y) = 1, 1 <= x, y <= n/p的个数.那么…