Pagini recente » Cod sursa (job #1854563) | Cod sursa (job #3205769) | Cod sursa (job #2143392) | Cod sursa (job #726504) | Cod sursa (job #2194574)
// euclidalg.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("euclid2.in");
ofstream out("euclid2.out");
int t;
pair <int, int> cmd;
inline int gcd(int a, int b)
{
if (!b) return a;
return gcd(b, a % b);
}
int main()
{
in >> t;
for (int i = 1; i <= t; i++)
{
in >> cmd.first >> cmd.second;
out << gcd(cmd.first, cmd.second) << '\n';
}
return 0;
}