#41388: python


suyueh (suyueh)

School : No School
ID : 272111
IP address : [101.10.93.239]
Last Login :
2024-12-10 22:48:32
a693. 吞食天地 | From: [125.229.229.84] | Post Date : 2024-07-23 16:00

from itertools import accumulate
while True:
  try:
    n, m = map(int, input().split())
    food = [int(i) for i in input().split()]
    food_sum = [0] + list(accumulate(food))
    for i in range(m):
      a, b = map(int, input().split())
      print(food_sum[b] - food_sum[a-1])
  except:
    break
 
ZeroJudge Forum