Cod sursa(job #1534302)
| Utilizator | Data | 23 noiembrie 2015 17:21:37 | |
|---|---|---|---|
| Problema | Sum | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.61 kb |
#include <iostream>
#include <stdio.h>
#define N 100001
using namespace std;
int main()
{
freopen("sum.in", "r", stdin);
freopen("sum.out", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
int phi[N];
for (int i = 1; i <= N; ++i)
phi[i] = i-1;
for (int i = 2; i <= N; ++i)
for (int j = 2*i; j <= N; j += i)
phi[j] -= phi[i];
long long n, x;
cin >> n;
for(int i = 0; i < n; i ++)
{
cin >> x;
long long suma = x * phi[x] * 2;
printf("%lld\n",suma);
}
return 0;
}
