Cod sursa(job #2251066)

Utilizator AlexandruGabrielAliciuc Alexandru AlexandruGabriel Data 1 octombrie 2018 09:21:33
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.38 kb
#include <bits/stdc++.h>

using namespace std;

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

long long Cmmdc (long long a, long long b)
{
    if (!b) return a;
    else return Cmmdc(b, a%b);
}

int main()
{
    long long q, a, b;
    fin >> q;
    while (q--)
    {
        fin >> a >> b;
        fout << Cmmdc(a, b) << "\n";
    }
    return 0;
}