Cod sursa(job #2356201)

Utilizator StefanUUngureanu Stefan Cristian StefanU Data 26 februarie 2019 15:59:27
Problema Algoritmul lui Euclid Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.36 kb
#include <bits/stdc++.h>

using namespace std;

constexpr int gcd(unsigned long a, unsigned long b)
{
    return (b==0)?a:gcd(b,a%b);
}


int main()
{
    freopen("euclid2.in","r",stdin);
    freopen("euclid2.out","w",stdout);
    unsigned int a,b,n;
    cin>>n;
    while(n){
    cin >>a>>b;
    cout<<gcd(a,b)<<endl;
    n--;
    }
    return 0;
}