Cod sursa(job #2653633)
| Utilizator | Data | 28 septembrie 2020 17:55:35 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
using namespace std;
string problem = "euclid2";
ifstream fin (problem + ".in");
ofstream fout(problem + ".out");
//https://www.infoarena.ro/problema/euclid2
int euclid(int a,int b)
{
while(b)
{
int aux = a % b;
a = b;
b = aux;
}
return a;
}
int main()
{
int t;
fin >> t;
while(t--)
{
int a,b;
fin >> a >> b;
fout << euclid(a,b) << "\n";
}
}
