Cod sursa(job #2449436)
Utilizator | Data | 19 august 2019 18:02:32 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin ("euclid2.in");
ofstream fout ("euclid2.out");
int t; long long int a, b, r;
fin >> t;
for (; t; --t) {
fin >> a >> b;
while (b != 0) {
r = a%b;
a = b;
b = r;
}
fout << a << "\n";
}
return 0;
}