问题
代码
n = int(input())
s = input()
l = s.split()
l = (int(i) for i in l)
mss = 0
mssa = 0
mssb = 0
t = 0
ta = 0
tb = 0
flag = 0
for i in l:
t += i
if flag == 1:
flag = 0
ta = i
if t < 0:
t = 0
flag = 1
else:
tb = i
if t > mss:
mss = t
mssa = ta
mssb = tb
print(mss, mssa, mssb)
有任何问题请回复提出。然后欢迎关注微信公众号格物致愚: