Cod sursa(job #3310584)
| Utilizator | Data | 15 septembrie 2025 12:40:09 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int main()
{
int n, x, y, r;
fin>>n;
while(n--){
fin>>x>>y;
if(x<y) swap(x,y);
do{
r = x%y;
x=y;
y=r;
}while(y>0);
fout<<x<<"\n";
}
}
