Cod sursa(job #3142727)
Utilizator | Data | 23 iulie 2023 20:01:26 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main(){
ifstream in("euclid.in");
ofstream out("euclid.out");
int t;
int x, y;
if(in.is_open()){
in >> t;
while(t--){
in >> x >> y;
int d = max(x, y) % min(x, y);
d == 0 ? out << min(x, y) << "\n" : out << d << "\n";
}
}
}