MaxSubsum/sus801 | MaxSubsum/armtatevik | ||||
---|---|---|---|---|---|
n | 1 | summa = 0 | n | 1 | summ = 0 |
2 | max_sum = 0 | 2 | maxsum = 0 | ||
3 | min_cif = 0 | 3 | otr = 0 | ||
4 | cifra = int(input()) | 4 | num = int(input()) | ||
5 | while cifra != 0: | 5 | while num != 0: | ||
6 | summa += cifra | 6 | summ += num | ||
7 | if max_sum < summa: | 7 | if maxsum < summ: | ||
8 | max_sum = summa | 8 | maxsum = summ | ||
9 | elif summa < 0: | 9 | elif summ < 0: | ||
10 | summa = 0 | 10 | summ = 0 | ||
11 | if cifra < 0 and min_cif == 0: | 11 | if num < 0 and otr == 0: | ||
12 | min_cif = cifra | 12 | otr = num | ||
13 | if cifra < 0 and cifra > min_cif: | 13 | if num < 0 and num > otr: | ||
14 | min_cif = cifra | 14 | otr = num | ||
15 | cifra = int(input()) | 15 | num = int(input()) | ||
16 | if max_sum != 0: | 16 | if maxsum != 0: | ||
17 | print(max_sum) | 17 | print(maxsum) | ||
18 | else: | 18 | else: | ||
t | 19 | print(min_cif) | t | 19 | print(otr) |
20 | 20 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|