Cod sursa(job #1703208)
| Utilizator | Data | 16 mai 2016 16:23:50 | |
|---|---|---|---|
| Problema | Sum | Scor | 85 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("sum.in");
ofstream out("sum.out");
const int maxn = 100005;
int a[100005];
int main()
{
int n;
in >> n;
for(int i = 1;i < 100005; i++)
a[i] = i - 1;
for(int i = 2; i < 100005; i++)
for(int j = 2; 1LL * i * j < 100005; j++)
a[i * j] = a[i * j] - a[i];
for(int i = 1; i <= n; i++)
{
long long x;
in >> x;
out << 2LL * x * a[x] << "\n";
}
return 0;
}
