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()

  

HR_Jumping on the Clouds的更多相关文章

  1. Clouds

    1.Eucalyptus: Eucalyptus is a Linux-based software architecture that implements scalable private and ...

  2. Codeforces 833E Caramel Clouds

    E. Caramel Clouds time limit per test:3 seconds memory limit per test:256 megabytes input:standard i ...

  3. 【CF833E】Caramel Clouds(线段树)

    [CF833E]Caramel Clouds(线段树) 题面 CF 洛谷 题解 首先把区间一段一段分出来,那么只有四种情况. 要么没有被任何一朵云被覆盖,那么直接就会产生这一段的贡献. 要么被一朵云覆 ...

  4. 【CF833E】Caramel Clouds

    [CF833E]Caramel Clouds 题面 洛谷 题目大意: 天上有\(n\)朵云,每朵云\(i\)会在时间\([li,ri]\)出现,你有\(C\)个糖果,你可以花费\(c_i\)个糖果让云 ...

  5. Optimization on content service with local search in cloud of clouds

    曾老师的这篇文章发表于Journal of Network and Computer Applications,主要解决的是利用启发式算法决定如何在cloud of clouds中进行副本分发,满足用 ...

  6. End-to end provisioning of storage clouds

    Embodiments discussed in this disclosure provide an integrated provisioning framework that automates ...

  7. (论文笔记Arxiv2021)Walk in the Cloud: Learning Curves for Point Clouds Shape Analysis

    目录 摘要 1.引言 2.相关工作 3.方法 3.1局部特征聚合的再思考 3.2 曲线分组 3.3 曲线聚合和CurveNet 4.实验 4.1 应用细节 4.2 基准 4.3 消融研究 5.总结 W ...

  8. 论文笔记:(2021CVPR)PAConv: Position Adaptive Convolution with Dynamic Kernel Assembling on Point Clouds

    目录 摘要 1.引言 2.相关工作 将点云映射到常规二维或三维栅格(体素) 基于MLPs的点表示学习 基于点卷积的点表示学习 动态卷积和条件卷积 3.方法 3.1 回顾 3.2 动态内核组装 Weig ...

  9. 论文笔记:(ICCV2019)KPConv: Flexible and Deformable Convolution for Point Clouds

    目录 摘要 一.引言 二.相关工作 投影网络 图卷积网络 逐点多层感知器网络 点卷积网络 三.核点卷积 3.1由点定义的核函数 3.2刚性的或可变形的核 3.3核点网络层 3.4核点网络架构 四.实验 ...

随机推荐

  1. yum 命令

    yum( Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器. 基於RPM包管理,能够从指定的服务器自动下载RPM包 ...

  2. How To: Capture Android & iOS Traffic with Fiddler

    How To: Capture iOS Traffic with Fiddlerhttps://www.telerik.com/blogs/how-to-capture-ios-traffic-wit ...

  3. Vmware由于centos升级内核不可运行(C header files matching your running kernel were not found)的解决方案

    C header files matching your running kernel were not found. Refer to your distribution's documentati ...

  4. RESTful架构详解

    什么是REST REST全称是Representational State Transfer,中文意思是表述性状态转移,它首次出现在2000年Roy Fielding的博士论文中.Roy Fieldi ...

  5. 2 JAVA 项目名称前红色叹号如何解决

    1 Java 项目前出现红色叹号Eclipse找不到项目需要的JAR包,可以在这里面解决: ① 右键点击项目,选择[Build Path].[Configure Build Path...] ② 在这 ...

  6. 局域网 FTP建立,搭建一个简易的局域网服务器

    1.创建用户名以及密码: 右键我的电脑 -> 管理->本地用户和组->右键用户->新用户----设置用户名密码: 2.安装IIS 和FTP :控制面板->程序->打 ...

  7. vue-axios的application/x-www-form-urlencod的post请求无法解析参数

    vue-axios的post会先将对象转为json然后再根据headers的设置再转一次格式,可以将参数先用qs.stringify()转一次再传输

  8. python数学第五天【常用概率分布】

    1. 概率基本公式 思考题: 3. 两点分布 4. 二项分布 推论一: 5.柏松分布 6. 均匀分布 7. 指数分布 8. 正态分布 9.常见分布的总结

  9. nginx 负载均衡(默认算法)

    使用 nginx 的upstream模块只需要几步就可以实现一个负载均衡: 在 nginx 配置文件中添加两个server server { listen ; server_name 192.168. ...

  10. 学习 Spring (十五) Advisor

    Spring入门篇 学习笔记 advisor 就像一个小的自包含的方面,只有一个 advice 切面自身通过一个 bean 表示,并且必须实现某个 advice 接口,同时 advisor 也可以很好 ...