Prsteni
This commit is contained in:
22
prsteni.py
Normal file
22
prsteni.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
radii = list(map(int, input().split()))
|
||||||
|
|
||||||
|
prev_r = None
|
||||||
|
prev_n = 1
|
||||||
|
prev_d = 1
|
||||||
|
for r in radii:
|
||||||
|
if prev_r is None:
|
||||||
|
prev_r = r
|
||||||
|
continue
|
||||||
|
|
||||||
|
n = prev_r * prev_n
|
||||||
|
d = r * prev_d
|
||||||
|
gcd = math.gcd(n, d)
|
||||||
|
n = n // gcd
|
||||||
|
d = d // gcd
|
||||||
|
print(f"{n}/{d}")
|
||||||
|
prev_n = n
|
||||||
|
prev_d = d
|
||||||
|
prev_r = r
|
||||||
Reference in New Issue
Block a user