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

    fptr.close()

  

原文地址:https://www.cnblogs.com/alfredsun/p/9732935.html

时间: 2025-01-14 00:20:52

HR_Jumping on the Clouds的相关文章

End-to end provisioning of storage clouds

Embodiments discussed in this disclosure provide an integrated provisioning framework that automates the process of provisioning storage resources, end-to-end, for an enterprise storage cloud environment. Such embodiments configure and orchestrate th

Clouds

1.Eucalyptus: Eucalyptus is a Linux-based software architecture that implements scalable private and hybrid clouds within your existingIT infrastructure. Eucalyptus allows you to use your own collections of resources (hardware, storage, and network)

openSource clouds

学习当前较主流的开源云基础设施管理软件by Ruiy summarize publish; 我擦,有不时候Ruiy干事也就那吊风格,啥事也就那么随口一说,你们太sensitivity,同网络延迟对存储的性能依赖一样,貌似还有过之而无不及; open source cloud computing(openStack,cloudStack,openNebula,Eucalyptus)及paas/saas/iass于2014/05/24 running mechanism; 熟悉了当前打多少主流的云

Paper Clouds 浮云

凯文·科恩的一首同名曲子,无意间查到的...... 找不到完整的乐谱好伤心.....不然有时间还能弹一下... 链接:http://www.77music.com/yuepu-25249.htm

Unity3d Realtime Dynamic Volume Clouds Rendering

Ray Marching体积渲染+perlin noise 动态效果: 博主近期渲染: 2016的渲染 2015后半段的渲染 ---- by wolf96

Unity3d Realtime Dynamic Clouds Rendering

双层云,Voronoi noise & Worley noise 博主近期渲染: 2016的渲染 2015后半段的渲染 ---- by wolf96  http://blog.csdn.net/wolf96

THE TOOLS TO MANAGE YOUR DATA ACROSS CLOUDS

http://blog.grexit.com/manage-data-across-clouds/ That the average small business uses a cloud service to enable collaboration and backup is pretty much a foregone conclusion. But what’s also rather common is the practice of using multiple cloud acco

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

毕设进了图网络的坑,感觉有点难,一点点慢慢学吧,本文方法是<Rethinking Table Recognition using Graph Neural Networks>中关系建模环节中的主要方法. ## 概述 本文是对经典的PointNet进行改进,主要目标是设计一个可以直接使用点云作为输入的CNN架构,可适用于分类.分割等任务.主要的创新点是提出了一个新的可微网络模块EdgeConv(边卷积操作)来提取局部邻域信息. 其整体的网络结构如下所示,值得注意的有: 整体的网络结构与Point

作业练习:3

1.列出当前系统上的所有已经登录的用户的用户名,注意:同一个用户登录多次,则只显示一次即可 who | cut -d ' '  -f1 | sort -u 2.取出最后登录到当前系统的用户的相关信息 last | head -1 | cut -d '  '  -f1 3.取出当前系统上被用户当作其默认shell的最多的那个shell cat /etc/passwd | cut -d: -f7 | uniq -c | sort -n  | tail -n 1 4.将/etc/passwd中的第三个