Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
57765 蔡璟恒 【一维数组】元素求和 Python3 Accepted 142 MS 4448 KB 323 2023-09-10 14:54:48

Tests(4/4):


Code:

n=int(input()) arr=[] for x in map(int,input().split()): arr.append(x) m=int(input()) s=[] for i in range (m): a,b=map(int,input().split()) r=[] r.append(a) r.append(b) s.append(r) for i in s: count=0 for j in range(i[0]-1,i[1]): count+=arr[j] print(count)