Cod sursa(job #3354737)

Utilizator Alex_at_gameIustin-Alexandru Frateanu Alex_at_game Data 20 mai 2026 09:34:13
Problema Fractii Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.79 kb
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(v) begin(v), end(v)
#define al(v, l, r) begin(v) + l, begin(v) + r + 1
#define sz(v) static_cast<int>(v.size())
#define pb push_back
#define pob pop_back
#define fs first
#define sd second

constexpr int inf = 2e9;
constexpr ll infll = 4e18;

int n;
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    freopen("fractii.in", "r", stdin);
    freopen("fractii.out", "w", stdout);

    cin >> n;
    ll ans = 0;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (__gcd(i, j) == 1) {
                ans++;
            }
        }
    }

    cout << ans << "\n";
}