21 lines
494 B
Python
21 lines
494 B
Python
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
from itertools import product
|
|
|
|
data = [[int(n.rstrip()) for n in l.split('\t')] for l in sys.stdin]
|
|
|
|
result = []
|
|
for line in [list(product(l, l)) for l in data]:
|
|
for tup in line:
|
|
if tup[0] == tup[1]:
|
|
continue
|
|
if tup[0] % tup[1] == 0:
|
|
result.append(tup)
|
|
break
|
|
elif tup[1] % tup[0] == 0:
|
|
result.append((tup[1], tup[0]))
|
|
break
|
|
|
|
print(sum(tup[0] / tup[1] for tup in result))
|