Mai intai trebuie sa te autentifici.
Cod sursa(job #1310597)
| Utilizator | Data | 6 ianuarie 2015 23:37:35 | |
|---|---|---|---|
| Problema | Sum | Scor | 45 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <fstream>
using namespace std;
int main()
{
ifstream f("sum.in");
ofstream g("sum.out");
unsigned int n,j,suma;
f >> n ;
unsigned int x;
unsigned int a,k;
while (f >> x)
{ suma = 0 ;
for(j=2;j<=2*x;j++)
{ k = j ; a= x ;
if (a%k!=0) {
while (k!=a) if (a > k) a-=k;
else k-= a;
if (k ==1)
suma += j ;}
}
suma++;g <<suma<<'\n';
}
return 0;
}
