题目:
代码:
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the jumpingOnClouds function below.
def jumpingOnClouds(c):
index = 0
count = 0
while index < len(c):
if index == len(c) - 1:
return count
if index + 2 < len(c) and c[index+2] == 0:
index += 2
count += 1
else:
index += 1
count += 1
return -1
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input())
c = list(map(int, input().rstrip().split()))
result = jumpingOnClouds(c)
fptr.write(str(result) + '\n')
fptr.close()
点赞关注留言~
谢谢各位捧场~