Cod sursa(job #2530322)
Utilizator | Data | 24 ianuarie 2020 17:51:15 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int T, A, B;
static inline int gcd (int a, int b)
{
int r = 0;
while(b)
{
r = a % b;
a = b;
b = r;
}
return a;
}
static inline void Test_Case ()
{
f >> A >> B;
g << gcd(A, B) << '\n';
return;
}
int main()
{
f.tie(NULL);
f >> T;
while(T--)
Test_Case();
return 0;
}