Cod sursa(job #3334549)

Utilizator EgreogHorvath George Egreog Data 18 ianuarie 2026 14:14:45
Problema Sum Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.36 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("sum.in");
ofstream fout("sum.out");

int main()
{
  int n, x;
  cin>>n;
  for(int i = 1; i <= n; i++)
    {
      cin>>x;
      int s = 0;
      for(int j = 0; j <= x * 2; j++)
        {
          if(__gcd(j, x) == 1)
            {
              s += j;
            }
        }
      cout<<s<<"\n";
    }
}