Pagini recente » Cod sursa (job #2089498) | Cod sursa (job #882373) | Cod sursa (job #1516257) | Cod sursa (job #1017819) | Cod sursa (job #875248)
Cod sursa(job #875248)
#include <iostream>
#include <fstream>
using namespace std;
static inline unsigned gcd(unsigned x, unsigned y)
{
if(!y) return x;
return gcd(y, x%y);
}
int main()
{
ifstream in("euclid2.in");
ofstream out("euclid2.out");
int n;
in >> n;
unsigned x, y;
for(int i = 0; i < n; ++i)
{
in >> x >> y;
out << gcd(x, y) << endl;
}
return 0;
}