Pagini recente » Cod sursa (job #2063565) | Cod sursa (job #2453607) | Cod sursa (job #1650478) | Diferente pentru problema/inversmodular intre reviziile 117 si 59 | Cod sursa (job #2170806)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fcin("euclid2.in");
ofstream fcout("euclid2.out");
int lnko(int a, int b)
{
if (a == b || b == 0)
return a;
while (b)
{
int tmp = a % b;
a = b;
b = tmp;
}
return a;
}
int main()
{
int t, x, y;
fcin >> t;
while (t)
{
fcin >> x >> y;
fcout << lnko(x, y) << '\n';
--t;
}
}