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核点网络架构 四.实验 ...
随机推荐
- C99标准的柔性数组 (Flexible Array)
[什么是柔性数组(Fliexible Array)] 柔性数组在C99中的定义是: 6.7.2.1 Structure and union specifiers As a special case, ...
- Java Integer 与 int 深刻理解
今天在做Object 自动转为Integer 类型之后的判断,遇到一个不理解的点,当数值超过127之后,两个数值相同的Object 对象用 == 判断的结果是false. Object a = 128 ...
- PL/SQL编程--变量声明及赋值
declare v_price ,);--单价 v_usenum number;--水费字数 v_usenum2 number;--使用吨数 begin v_price:=2.45;--每吨单价 v_ ...
- php 删除一维数组中某一个值元素的操作方法
1. 自己写for循环 从array里去掉$tmp这个元素的值 ? 1 2 3 4 5 6 7 8 9 10 <?php $tmp = '324'; $arr = array( '0' => ...
- element-ui 源码解析 二
Carousel 走马灯源码解析 1. 基本原理:页面切换 页面切换使用的是 transform 2D 转换和 transition 过渡 可以看出是采用内联样式来实现的 举个栗子 <div : ...
- uwsgi加nginx部署django restframework前后端分离项目
一.uwsgi和nginx简介 1.uwsgi(摘抄于百度百科): uWSGI是一个Web服务器,它实现了WSGI协议.uwsgi.http等协议.Nginx中HttpUwsgiModule的作用是与 ...
- 集合之LinkedHashSet(含JDK1.8源码分析)
一.前言 上篇已经分析了Set接口下HashSet,我们发现其操作都是基于hashMap的,接下来看LinkedHashSet,其底层实现都是基于linkedHashMap的. 二.linkedHas ...
- Jetson TX1 install py-faster-rcnn
Install py-faster-rcnn following the official version https://github.com/rbgirshick/py-faster-rcnn ...
- Vue获取dom和数据监听
Vue获取dom对象 在js和jq中我们都能获取dom对象例如 // 获取id=1的div标签 <div id=d1>dom对象</div> // js语法 let ele = ...
- docker之harbor仓库注意事项
首先修改harbor的配置文件harbor.cfg hostname可以是ip也可以是主机名 修改docker/etc/docker/daemon.json 添加insecure-registries ...