HR_Jumping on the Clouds

Posted alfredsun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HR_Jumping on the Clouds相关的知识,希望对你有一定的参考价值。

1.没有考虑i+2越界的问题

2.没有考虑结尾三个零导致 -5

3.没有考虑len(c)<2 导致 -5

 

#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the jumpingOnClouds function below.
def jumpingOnClouds(c):

    count = 0
    i = 0
    while(i + 2 < len(c)):
        if c[i+2] == 0:
            count = count + 1
            i = i + 2
        else:
            count = count + 1
            i = i + 1
    if len(c)<=2:
        count = count + 1
    else:
        if c[-2] == 0 and c[-3] == 1:
            count = count + 1

    return count


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) + ‘
‘)

    fptr.close()

  

以上是关于HR_Jumping on the Clouds的主要内容,如果未能解决你的问题,请参考以下文章

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path之二(示例代

论文阅读DGCNN:Dynamic Graph CNN for Learning on Point Clouds

DB Query Analyzer 6.03, the most excellent Universal DB Access tools on any Microsoft Windows OS(示例代

MATLAB中mesh函数的使用:基于像素强度画3D密度图(create a 3D density plot based on the pixel intensity:mesh function)(代

坑The server time zone value '?й???????' is unrecognized or represents more than one time z(代

The constructor ClassPathXmlApplicationContext(String) refers to the missing type BeansException(示例代