from itertools import accumulate n = int(input()) arr = list(map(int, input().split())) k = int(input()) S = [0] + list(accumulate(arr)) for _ in range(k): l, r = map(int, input().split()) print(S[r] - S[l - 1])
微信直接扫码登录
使用经过邮箱注册的账号密码登录