다음 코드는 N 개 정수의 합을 출력해야 하지만 누적 변수의 초기값이 잘못돼 결과가 어긋난다. 올바른 결과를 출력하라.
n = int(input()) arr = list(map(int, input().split())) total = arr[0] for x in arr: total += x print(total)
1 ≤ N ≤ 10^5, -10^6 ≤ Ai ≤ 10^6
3 1 2 3
6
5 1 2 3 4 5
15
1 42
42