Cod sursa(job #2448966)
Utilizator | Data | 17 august 2019 18:08:58 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 40 |
Compilator | py | Status | done |
Runda | Arhiva educationala | Marime | 0.27 kb |
#!/usr/bin/env python3
def gcd(a, b):
return a if not b else gcd(b, a % b)
fout = open('euclid2.out', 'w')
with open('euclid2.in', 'r') as fin:
for _ in range(int(fin.readline())):
fout.write(str(gcd(*map(int, fin.readline().split()))) + '\n')
fout.close()