MaxSubsum/Stephan | MaxSubsum/abrivan | ||||
---|---|---|---|---|---|
n | 1 | a = input() | n | 1 | s = input() |
2 | x = eval(a) | 2 | a = eval(s) | ||
3 | suma = 0 | 3 | suma = 0 | ||
n | 4 | max_sum = x | n | 4 | max_sum = a |
5 | if x < 0: | 5 | if a < 0: | ||
6 | y = False | 6 | zn = False | ||
7 | else: | 7 | else: | ||
n | 8 | y = True | n | 8 | zn = True |
9 | while x != 0: | 9 | while a != 0: | ||
10 | suma = suma + x | 10 | suma = suma + a | ||
11 | if suma > max_sum: | 11 | if suma > max_sum: | ||
12 | max_sum = suma | 12 | max_sum = suma | ||
n | 13 | if not y: | n | 13 | if not zn: |
14 | if x < 0: | 14 | if a < 0: | ||
15 | if x > max_sum: | 15 | if a > max_sum: | ||
16 | max_sum = x | 16 | max_sum = a | ||
17 | else: | 17 | else: | ||
n | 18 | y = True | n | 18 | zn = True |
19 | suma = x | 19 | suma = a | ||
20 | if x > max_sum: | 20 | if a > max_sum: | ||
21 | max_sum = x | 21 | max_sum = a | ||
22 | if suma < 0: | 22 | if suma < 0: | ||
23 | suma = 0 | 23 | suma = 0 | ||
t | 24 | a = input() | t | 24 | s = input() |
25 | x = eval(a) | 25 | a = eval(s) | ||
26 | print(max_sum) | 26 | print(max_sum) | ||
27 | 27 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|