Skip to content

Instantly share code, notes, and snippets.

@modos
Created April 26, 2023 11:12
Show Gist options
  • Save modos/49b41a4cff0314a718f5f578155eb488 to your computer and use it in GitHub Desktop.
Save modos/49b41a4cff0314a718f5f578155eb488 to your computer and use it in GitHub Desktop.
بزرگ‌ترین زیربازه ۱
n = int(input())
a = [int(x) for x in input().split()]
ans = -10**9
for r in range(1, n + 1):
for l in range(r):
s = 0
for i in range(l, r):
s += a[i]
if ans < s:
ans = s
print(ans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment