| MaxSubsum/Chosen__1 | MaxSubsum/s_02180027 | ||||
|---|---|---|---|---|---|
| n | 1 | x = int(input()) | n | 1 | d = int(input()) |
| 2 | s = 0 | ||||
| 3 | max = d | ||||
| 4 | while d: | ||||
| 5 | s += d | ||||
| 6 | if s > max: | ||||
| 7 | max = s | ||||
| 8 | if s < 0: | ||||
| 9 | s = 0 | ||||
| 10 | d = int(input()) | ||||
| 11 | else: | ||||
| 12 | print(max) | ||||
| 2 | 13 | ||||
| t | 3 | summ = 0 | t | ||
| 4 | ans = x | ||||
| 5 | |||||
| 6 | while x != 0: | ||||
| 7 | summ += x | ||||
| 8 | if summ > ans: | ||||
| 9 | ans = summ | ||||
| 10 | if summ < 0: | ||||
| 11 | summ = 0 | ||||
| 12 | x = int(input()) | ||||
| 13 | |||||
| 14 | print(ans) | ||||
| 15 | |||||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||