Cod sursa(job #1936615)
Utilizator | Data | 23 martie 2017 11:24:33 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <fstream>
using namespace std;
ifstream in ("euclid2.in");
ofstream out ("euclid2.out");
long long N, X, Y;
long long CMMDC (long long x, long long y) {
if (y == 0) {
return x;
}
CMMDC (y, x % y);
}
int main()
{
in >> N;
for(; N; -- N) {
in >> X >> Y;
out << CMMDC (X,Y) <<'\n';
}
return 0;
}