import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
sum = [a[0]]
#sum의 0번째 인덱스에는 비교를 위해 a[0]를 넣어준다.
for i in range(n-1):
sum.append(max(sum[i]+a[i+1], a[i+1]))
print(max(sum))
'문제풀이 > 백준(Boj) 문제풀이' 카테고리의 다른 글
[백준][정수론 및 조합론] 1037. 약수 (파이썬/Python) (0) | 2021.09.23 |
---|---|
[백준][정수론 및 조합론] 5086. 배수와 약수 (파이썬/Python) (0) | 2021.09.23 |
[백준][그리디 알고리즘] 13305. 주유소 (파이썬/Python) (0) | 2021.09.23 |
[백준][그리디 알고리즘] 1541. 잃어버린 괄호 (파이썬/Python) (0) | 2021.09.20 |
[백준][그리디 알고리즘] 11399. ATM (파이썬/Python) (0) | 2021.09.20 |