Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
57460 木木老师 【一维数组】元素求和 Python3 Accepted 139 MS 4444 KB 329 2023-09-03 14:20:33

Tests(4/4):


Code:

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