Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
57764 陈宣霖 【一维数组】元素求和 Python3 Accepted 139 MS 4436 KB 331 2023-09-10 14:51:55

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)