Given the value of N , you will have to nd the value of G . The de nition of G is given below: G = i<N ∑ i =1 j N ∑ j = i +1 GCD ( i; j ) Here GCD ( i; j ) means the greatest common divisor of integer i and integer j . For those who have trouble unde…
Code: #include<cstdio> using namespace std; const int maxn=4000005; const int R=4000002; const int N=4000002; long long sumv[maxn],f[maxn]; int phi[maxn],prime[maxn],vis[maxn]; void solve(){ phi[1]=1; int cnt=0; for(int i=2;i<=R;++i){ if(!vis[i])…
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Problem JGCD Extreme (II)Input: Standard Input Output: Standard Output Given the value of N, you will have to find the value of G. The definition of G is given below: Here GCD(i,j) means the…