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()
HR_Jumping on the Clouds的更多相关文章
- Clouds
1.Eucalyptus: Eucalyptus is a Linux-based software architecture that implements scalable private and ...
- Codeforces 833E Caramel Clouds
E. Caramel Clouds time limit per test:3 seconds memory limit per test:256 megabytes input:standard i ...
- 【CF833E】Caramel Clouds(线段树)
[CF833E]Caramel Clouds(线段树) 题面 CF 洛谷 题解 首先把区间一段一段分出来,那么只有四种情况. 要么没有被任何一朵云被覆盖,那么直接就会产生这一段的贡献. 要么被一朵云覆 ...
- 【CF833E】Caramel Clouds
[CF833E]Caramel Clouds 题面 洛谷 题目大意: 天上有\(n\)朵云,每朵云\(i\)会在时间\([li,ri]\)出现,你有\(C\)个糖果,你可以花费\(c_i\)个糖果让云 ...
- Optimization on content service with local search in cloud of clouds
曾老师的这篇文章发表于Journal of Network and Computer Applications,主要解决的是利用启发式算法决定如何在cloud of clouds中进行副本分发,满足用 ...
- End-to end provisioning of storage clouds
Embodiments discussed in this disclosure provide an integrated provisioning framework that automates ...
- (论文笔记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 ...
- 论文笔记:(2021CVPR)PAConv: Position Adaptive Convolution with Dynamic Kernel Assembling on Point Clouds
目录 摘要 1.引言 2.相关工作 将点云映射到常规二维或三维栅格(体素) 基于MLPs的点表示学习 基于点卷积的点表示学习 动态卷积和条件卷积 3.方法 3.1 回顾 3.2 动态内核组装 Weig ...
- 论文笔记:(ICCV2019)KPConv: Flexible and Deformable Convolution for Point Clouds
目录 摘要 一.引言 二.相关工作 投影网络 图卷积网络 逐点多层感知器网络 点卷积网络 三.核点卷积 3.1由点定义的核函数 3.2刚性的或可变形的核 3.3核点网络层 3.4核点网络架构 四.实验 ...
随机推荐
- MySQL左连接时 返回的记录条数 比 左边表 数量多
在学MySQL的连接时,为了便于记忆,就将左连接 记做 最后结果的总记录数 和 进行左连接的左表的记录数相同,简单的说就是下面这个公式 count(table A left join table B) ...
- XManager&XShell如何保存登录用户和登录密码
Xshell配置ssh免密码登录 - qingfeng2556的博客 - CSDN博客https://blog.csdn.net/wuhenzhangxing/article/details/7948 ...
- Windows10常用快捷键
1. 打开注册表 ctrl+R ---> regedit 2.打开资源管理器 win + E 3.切换到桌面 win + D 再按一次可以进行还原 4.锁屏 win+ ...
- Python3练习题 022:用递归函数反转字符串
方法一 str = input('请输入若干字符:') def f(x): if x == -1: return '' else: return s ...
- [官网]How to use distributed transactions with SQL Server on Docker
How to use distributed transactions with SQL Server on Docker https://docs.microsoft.com/en-us/sql/l ...
- java随笔4 java中接参整形转字符串
通过+‘’来实现
- lombok 使用 Idea
Lombok 是一种 Java™ 实用工具,可用来帮助开发人员消除 Java 的冗长,尤其是对于简单的 Java 对象(POJO).它通过注解实现这一目的.import lombok.Getter;i ...
- LODOP直接用base64码输出图片
Lodop中的ADD_PRINT_IMAGE,也可以直接输出base64码图片,不用加img标签,如果加了img标签,会被当做超文本对待,受浏览器引擎解析的影响. 什么时候使用base64码直接输出比 ...
- 天虎云商wap和微信话项目总结
1:架构:以后要采用项目分模块的方式写代码了,不能写一个公用的controller包,每个模块分包,分别建立service,dao,但是模块同级的有个功能的baseDao, BaseSe ...
- 学习 Spring (十) 注解之 @Bean, @ImportResource, @Value
Spring入门篇 学习笔记 @Bean @Bean 标识一个用于配置和初始化一个由 Spring IoC 容器管理的新对象的方法,类似于 XML 配置文件的 可以在 Spring 的 @Config ...