Pagini recente » Cod sursa (job #2974344) | Cod sursa (job #1710417) | Cod sursa (job #525287) | Diferente pentru problema/nave_interdimensionale intre reviziile 6 si 53 | Cod sursa (job #3005514)
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
int gcd(int a, int b)
{
int r;
while (b)
{
int r = a % b;
a = b;
b = r;
}
return a;
}
int main()
{
ifstream fin("abx.in");
ofstream fout("abx.out");
int n, x, y;
fin >> n;
while (n--)
{
fin >> x >> y;
fout << gcd(x, y);
}
return 0;
}