Cod sursa(job #191589)
Utilizator | Data | 27 mai 2008 14:24:20 | |
---|---|---|---|
Problema | Sum | Scor | 95 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <stdio.h>
long long n,i,j,a[100002],x;
int main()
{
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
scanf("%lld",&n);
for (i=1; i<=100000; ++i) a[i]=i-1;
for (i=2; i<=100000; ++i)
for (j=i*2; j<=100000; j+=i) a[j]-=a[i];
while (n)
{
--n;
scanf("%lld",&x);
printf("%lld\n",2*x*a[x]);
}
return 0;
}