Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- from decimal import Decimal, getcontext
- getcontext().prec = 6
- n = int(input())
- a = input().split()
- b = []
- for i in range(n):
- k = float(a[i]) * 100
- k = int(k)
- b.append(k)
- #print(b)
- pf = [0] * n
- pf[0] = b[0]
- for i in range(1, n):
- pf[i] = pf[i - 1] * b[i]
- q = int(input())
- #print(b)
- #print(pf)
- for i in range(q):
- s = input().split()
- l = int(s[0])
- l -= 1
- r = int(s[1])
- div = 1
- if l > -1:
- div = pf[l]
- print(div, pf[r])
- res = pf[r] * 1.0 / div
- print(res)
- res = math.pow(res, 1.0 / (r - l)) / 100
- print(Decimal(res))
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement