Cod sursa(job #3360869)
| Utilizator | Data | 17 iulie 2026 14:26:12 | |
|---|---|---|---|
| Problema | Sum | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream cin("sum.in");
ofstream cout("sum.out");
int n, x, y, suma, cmmdc, r;
cin >> n;
for(int i=1; i<=n; i++)
{
cin >> x;
suma=0;
y=0;
while(y<=2*x)
{
while(y>0)
{
r=x%y;
x=y;
y=r;
}
cmmdc=x;
if(cmmdc==1)
suma=suma+y;
y=y+1;
}
cout << suma;
}
return 0;
}
