Cod sursa(job #2865180)

Utilizator QwertyDvorakQwerty Dvorak QwertyDvorak Data 8 martie 2022 16:16:29
Problema Algoritmul lui Euclid Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.5 kb
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define dbg(x) cout << #x <<": " << x << "\n";
using ll = long long;

const string myf = "euclid2";
ifstream fin(myf + ".in");
ofstream fout(myf + ".out");

int a, b;
int t;
int gcd(int a, int b) {
	while (b) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int main() {

	fin >> t;
	while (t--) {

		fin >> a >> b;
		fout << gcd(a, b) << '\n';
	}
	fin.close();
	fout.close();
	return 0;
}