MaxSubsum/Bernard04 | MaxSubsum/ikobzev | ||||
---|---|---|---|---|---|
f | 1 | a = int(input()) | f | 1 | a = int(input()) |
n | 2 | n | |||
3 | ans = a | 2 | ans = a | ||
n | 4 | sum = 0 | n | 3 | max_sum = 0 |
5 | |||||
6 | while a != 0: | 4 | while a != 0: | ||
t | 7 | sum += a | t | 5 | max_sum += a |
8 | ans = max(ans, sum) | 6 | ans = max(ans, max_sum) | ||
9 | sum = max(sum, 0) | 7 | max_sum = max(max_sum, 0) | ||
10 | |||||
11 | a = int(input()) | 8 | a = int(input()) | ||
12 | 9 | ||||
13 | print(ans) | 10 | print(ans) | ||
14 | 11 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|