Cod sursa(job #327185)
| Utilizator | Data | 27 iunie 2009 15:26:03 | |
|---|---|---|---|
| Problema | Sum | Scor | 35 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include<iostream>
#include<stdio.h>
long long a,b;
int div(long long a,long long b)
{
if(b==0) return a;
else
return div(b,a%b);
}
int main()
{
freopen("sum.in","r",stdin);
freopen("sum.out","w",stdout);
long long n,i,j,x,s=0;
scanf("%lld\n",&n);
for(i=1;i<=n;i++)
{
s=0;
scanf("%lld\n",&x);
for(j=1;j<=2*x;j++)
if(div(j,x)==1) s+=j;
printf("%lld\n",s);
}
return 0;
}
