其他分享
首页 > 其他分享> > 201909-2 小明种苹果(续)

201909-2 小明种苹果(续)

作者:互联网

201909-2 小明种苹果(续)

n = int(input())
T = 0
D = 0
E = [0 for i in range(n)]
for i in range(n):
flag = 0
apple = list(map(int, input().split()))
cnt = apple[1]
for j in range(2, apple[0]+1):
if apple[j] <= 0:
cnt += apple[j]
else:
if cnt != apple[j]:
cnt = apple[j]
flag = 1
T += cnt
if flag:
E[i] = 1
D += 1
flag = 0
else:
E[i] = -1
e = 0
for i in range(n):
if E[i] == 1 and E[(i-1) % n] == 1 and E[(i+1) % n] == 1:
e += 1
print(T, D, e)

标签:cnt,apple,小明种,int,range,flag,苹果,201909
来源: https://blog.csdn.net/qq_43083719/article/details/113790585