Cod sursa(job #1563184)

Utilizator AetheryonStefan Bereghici Aetheryon Data 5 ianuarie 2016 18:50:38
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
const char *IN  = "euclid2.in";
const char *OUT = "euclid2.out";

class Math{
    private :
        Math(){};
        ~Math(){};
    public :
        static int getGCD(int a,int b){
            return (a==0) ? b : getGCD(b%a,a);
        }
    };
int q,a,b;
int main(void){
    ifstream cin(IN);
    ofstream cout(OUT);
    cin>>q;
    while(q--){
        cin>>a>>b;
        cout<<Math::getGCD(a,b)<<endl;
    }
    return 0;
}