Cod sursa(job #2278746)
Utilizator | Data | 8 noiembrie 2018 15:17:12 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<fstream>
using namespace std;
int gcd(int a, int b)
{
if (!b) return a;
return gcd(b, a % b);
}
int main()
{
ifstream cin("euclid2.in");
ofstream cout("euclid2.out");
unsigned long long a,b,t,i;
cin>>t;
for(i=1;i<=t;++i)
{
cin>>a>>b;
cout<<gcd(a,b)<<endl;
}
}