Cod sursa(job #3200872)
| Utilizator | Data | 5 februarie 2024 22:35:43 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.34 kb |
#include <bits/stdc++.h>
using namespace std;
long long a,b,t;
long long gcd(long long c,long long d)
{
if (d==0) return c;
else return gcd(d,c%d);
}
int main()
{
freopen("euclid2.in","r",stdin);
freopen("euclid2.out","w",stdout);
cin >> t ;
while (t--)
{
cin >> a >> b ;
cout << gcd(a,b) << "\n";
}
return 0;
}
