Cod sursa(job #3254995)
Utilizator | Data | 9 noiembrie 2024 11:07:53 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
long long a, b, n;
int main()
{
fin >> n;
while (n--){
fin >> a >> b;
while (b){
a %= b;
swap(a, b);
}
fout << a << endl;
}
return 0;
}