Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import fileinput
- times = []
- q = -1
- for (count, line) in enumerate(fileinput.input()):
- if count == 0:
- n = int(line.strip())
- elif count == 1:
- times = list(map(lambda x: int(x.strip()), line.split(" ")))
- times.insert(0, 0)
- for i in range(1, n + 1):
- times[i] += times[i - 1]
- else:
- s = line.split(" ")
- if len(s) == 1 and q == -1:
- q = int(line)
- elif q != -1:
- if count - 2 > q: break
- (t0, t1) = tuple(map(lambda x: int(x), line.split(" ")))
- time = times[t1] - times[t0 - 1]
- print(time / (t1 - t0 + 1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement