Cod sursa(job #2014330)
Utilizator | Data | 23 august 2017 14:25:52 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.27 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int main()
{
int i,T;
long long x,y,r;
f >> T;
for(i=1;i<=T;i++)
{
f >> x >> y;
while(y)
{
r = x % y;
x = y;
y = r;
}
g << x << endl;
}
}