-
[백준] 11659 - 구간 합 구하기 4 (파이썬)알고리즘/백준 2021. 9. 23. 16:25
import sys input = sys.stdin.readline n, m = map(int,input().split()) number = list(map(int,input().split())) for i in range(1,len(number)): number[i] += number[i-1] for i in range(m): x, y = map(int,input().split()) if x==1: print(number[y-1]) else: print(number[y-1]-number[x-2])
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 12869 - 뮤탈리스크 (파이썬) (0) 2021.09.23 [백준] 12738 - 가장 긴 증가하는 부분 수열 3 (파이썬) (0) 2021.09.23 [백준] 11066 - 파일 합치기 (파이썬) (0) 2021.09.23 [백준] 11058 - 크리보드 (파이썬) (0) 2021.09.23 [백준] 11052 - 카드 구매하기 (파이썬) (0) 2021.09.23