Cod sursa(job #2941509)
Utilizator | Data | 17 noiembrie 2022 20:27:29 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int t, x, y;
int gcd(int a, int b){
int r;
do{
r = a % b;
a = b;
b = r;
}
while(r);
return a;
}
int main()
{
fin >> t;
while(t--){
fin >> x >> y;
fout << gcd(x, y) << '\n';
}
}