题目: Longge is good at mathematics and he likes to think about hard mathematical problems which will be solved by some graceful algorithms. Now a problem comes: Given an integer N(1 < N < 2^31),you are to calculate ∑gcd(i, N) 1<=i <=N. "Oh…
Description Longge is good at mathematics and he likes to think about hard mathematical problems which will be solved by some graceful algorithms. Now a problem comes: Given an integer N(1 < N < 2^31),you are to calculate ∑gcd(i, N) 1<=i <=N. …
https://oj.neu.edu.cn/problem/1460 思路:若n=(p1^a1)*(p2^a2)...(pn^an),则f(n,0)=a1*a2*...*an,显然f(n,0)是积性函数,对于f(x,y)可以看出他是f(x,y-1)与自身进行狄利克雷卷积得到的结果,所以f(x,y)也是积性函数.因此,只要对n质因子分解,然后与预理出次方的dp值即可.注意积性函数的概念中a,b必须互质! #include<bits/stdc++.h> #define int long long…