Cod sursa(job #2629763)
Utilizator | Data | 22 iunie 2020 16:37:13 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
long long gcd(long long a, long long b)
{
if(a == 0)
return b;
return gcd(b % a,a);
}
int main()
{
int t;
fin >> t;
while(t--)
{
long long a,b;
fin >> a >> b;
fout << gcd(a,b) << endl;
}
}