Cod sursa(job #2959888)
Utilizator | Anastase Luca George Luka77 | Data | 2 ianuarie 2023 23:23:50 |
---|---|---|---|
Problema | Fractii | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
/// INPUT / OUTPUT
ifstream fin("fractii.in");
ofstream fout("fractii.out");
/// GLOBAL VARIABLES
int n;
/// SOLUTION
inline void solve()
{
int cnt = 1;
for(int i = 1; i < n; ++ i)
{
for(int j = i + 1; j <= n; ++ j)
{
if(__gcd(i, j) == 1)
cnt+=2;
}
}
fout << cnt;
}
/// READING THE INPUT
int main()
{
ios::sync_with_stdio(false);
fin.tie(NULL);
fout.tie(NULL);
fin >> n;
solve();
}