#41388: python


suyueh (suyueh)

學校 : 不指定學校
編號 : 272111
來源 : [49.216.220.150]
最後登入時間 :
2024-12-26 21:34:55
a693. 吞食天地 | From: [125.229.229.84] | 發表日期 : 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