Joos's blog
Reading time ~1 minute
https://www.acmicpc.net/problem/1912
n = int(input()) nums = list(map(int, input().split())) d = [0]*n d[0] = nums[0] for i in range(1, n): d[i] = nums[i] if d[i-1] + d[i] > d[i]: d[i] = d[i-1] + d[i] print(max(d))