Cod sursa(job #2587879)

Utilizator k2e0e0w3qDumitrescu Gheorghe k2e0e0w3q Data 23 martie 2020 17:58:12
Problema Algoritmul lui Euclid Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.39 kb
#include <bits/stdc++.h>
using namespace std;

inline int gcd (int a, int b) {return b?gcd(b, a%b):a;}
int main () {
    ifstream fin ("euclid2.in");
    ofstream fout ("euclid2.out");
    ios::sync_with_stdio(false);
    fin.tie(NULL);
    fout.tie(NULL);

    int n, x, y;
    for (fin >> n; n; n--) {
        fin >> x >> y;
        fout << gcd(x, y) << '\n';
    }
    return 0;
}