Cod sursa(job #1250123)
Utilizator | Data | 27 octombrie 2014 20:22:26 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
if(b==0)
return a;
else
gcd(b,a%b);
}
int main()
{
freopen("euclid2.in","r",stdin);
freopen("euclid2.out","w",stdout);
int tc;
ll a,b;
cin>>tc;
while(tc--)
{
cin>>a>>b;
cout<<gcd(a,b)<<"\n";
}
}