Pagini recente » Monitorul de evaluare | Monitorul de evaluare | Cod sursa (job #1549777) | Cod sursa (job #1549719) | Cod sursa (job #2029821)
#include <fstream>
using namespace std;
ifstream fin ("euclid.in");
ofstream fout ("euclid.out");
int n;
unsigned long long x, y;
unsigned long long gcd (unsigned long long x, unsigned long long y) {
long long aux;
while (x % y) {
aux = y;
y = x % y;
x = aux;
}
return y;
}
int main () {
fin >> n;
for (int i = 1; i <= n; i++) {
fin >> x >> y;
fout << gcd (x, y) << "\n";
}
return 0;
}