Cod sursa(job #3255069)

Utilizator maxtraAlex Deonise maxtra Data 9 noiembrie 2024 12:59:57
Problema Algoritmul lui Euclid Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.4 kb
# include <bits/stdc++.h>
using namespace std;

int main()
{
    ifstream fin("euclid2.in");
    ofstream fout("euclid2.out");
    long long n;
    fin >> n;
    for(int i = 1; i <= n; i++){
        long long x , y;
        fin >> x >> y;
        while(y != 0){
            int r = x % y;
            x = y;
            y = r;
        }
        fout << x << endl;
    }
    
    return 0;
}