Skip to content

Instantly share code, notes, and snippets.

@modos
Last active December 23, 2022 11:18
Show Gist options
  • Save modos/8c1f9a0c360aeb0ead79c4586f93500f to your computer and use it in GitHub Desktop.
Save modos/8c1f9a0c360aeb0ead79c4586f93500f to your computer and use it in GitHub Desktop.
فرزاد کارکن
import numpy
a = int(input())
b = [int(t) for t in input().split()]
if max(b) <= 0:
print(0)
else:
h = [max(b)]
for i in range(2, a):
for j in range(0, (a - (i)) + 1):
h.append(numpy.sum([b[k] for k in range(j, j + i)]))
print(max(h))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment