Cod sursa(job #2369624)
Utilizator | Data | 6 martie 2019 08:27:01 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f ("euclid2.in");
ofstream g ("euclid2.out");
int x,y,t;
int usu(int x,int y)
{
int r=0;
while(y)
{
r=x%y;
x=y;
y=r;
}
return x;
}
int main()
{
ios::sync_with_stdio(false);
f>>t;
while(t--)
{
f>>x>>y;
g<<usu(x,y)<<'\n';
}
return 0;
}