Cod sursa(job #1768186)

Utilizator UPB_CodeJunkiesUPB NAIDEN NICOLICIOIU COTET UPB_CodeJunkies Data 30 septembrie 2016 14:02:39
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.31 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("euclid2.in");
ofstream fout("euclid2.out");

const int NMAX = 1e5;

int a, b;

int gcd(int a, int b) {

	return (a == 0) ? b : gcd(b % a, a);
}

int main() {

	int t;
	fin >> t;

	while(t--) {

		fin >> a >> b;
		fout << gcd(a, b) << '\n';
	}

	return 0;
}