我也没弄懂他的测试用例具体用的是什么,例子给的太少了,通过30%,各路大神解析一下: 附代码:
n = int(input())
data = [] for i in input().strip().split(" "):
data.append(int(i))
cus = 0 res = 0 while cus <= n-1: #print(cus) if cus == n-1: if data[cus]==0:
res +=1 break if data[cus] == 0:
cus +=1 res +=1 elif data[cus] == data[cus +1]:
cus +=2 res +=1 else:
cus +=1 print(res)