Pagini recente » Cod sursa (job #72072) | Cod sursa (job #1544898) | Cod sursa (job #2264556) | Cod sursa (job #691848) | Cod sursa (job #677425)
Cod sursa(job #677425)
# include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int t;
int x, y, d;
inline void euclid( int a, int b, int &d )
{
if ( b == 0 )
d = a;
else
euclid( b, a % b, d );
}
inline void citire()
{
int t, i;
f >> t;
for ( i = 1 ; i <= t ; i++ )
{
f >> x >> y;
euclid( x, y, d );
g << d << "\n";
}
}
int main()
{
citire();
return 0;
}