杭电1008-Elevator

杭电oj 1008 :Elevator 杭州电子科技大学 online judge 1008 Problem Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevato... 阅读详情

Elevator

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 53208    Accepted Submission(s): 29402


Problem Description
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each stop.

For a given request list, you are to compute the total time spent to fulfill the requests on the list. The elevator is on the 0th floor at the beginning and does not have to return to the ground floor when the requests are fulfilled.
 

Input
There are multiple test cases. Each case contains a positive integer N, followed by N positive numbers. All the numbers in the input are less than 100. A test case with N = 0 denotes the end of input. This test case is not to be processed.
 

Output
Print the total time on a single line for each test case. 
 

Sample Input
1 2 3 2 3 1 0
 

Sample Output
17 41
 

这是个简单的数学计算题!

AC代码:


#include<cstdio>
int main()
{
	int a,n,i,b,t,time;
	while(scanf("%d",&n),n)
	{
		time=0;
		t=0;
		time+=n*5;//停止用的时间
		for(i=0;i<n;i++)
		{
			scanf("%d",&a);
			if(a>t)
			 time+=(a-t)*6;//每次和前一个比较若是上楼,则一层加6
			 else
			 time+=(t-a)*4;//下一层加4
			 t=a;
		 } 
		 printf("%d\n",time); 
	 } 
	 return 0;
 } 





『杭电1008』Elevator Problem Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified... 阅读详情

相关推荐

【目标跟踪】ECO算法论文阅读:ECO: Efficient Convolution Operators for Tracking

这里所指的训练集是指保存了每一帧的跟踪结果的训练集,也就是说,每一次进行model update的时候,要用在这一帧之前所有跟踪到的样本。那么随着视频越来越长,这个训练集就会越来越大。因为当目标被遮挡或者丢失的时候,比较新的这些样本本身就是错的,那么模型很容易有model drift,就是被背景或者错误的目标污染,导致跟踪结果出错。如下图所示,Baseline是传统的训练集,每更新一帧就加一个进来,那么连续的数帧后训练集里面的样本都是高度相似的,即容易遗忘前面的样本,且容易对最近的若干帧样本过拟合。

qq_43799400的博客 2610

1008 Elevator java

The highest building in our city has only one elevator. A request list is made up withNpositive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec...

有梦的博客 272

Ubuntu升级遇到grub-efi-amd64-signed安装失败?3步搞定这个烦人错误

本文深度解析Ubuntu系统升级时grub-efi-amd64-signed安装失败并提示“cannot find EFI directory”错误的根本原因。该错误通常由EFI系统分区挂载异常、BIOS/UEFI引导模式不匹配或dpkg包状态死锁导致。文章提供了三步精准修复流程:首先检查并修复ESP分区挂载,其次处理dpkg依赖问题,最后针对传统BIOS系统提供适配方案,帮助用户安全彻底地解决这一常见升级难题。

r7s8t的博客 398

PAT甲级1008 Elevator Java

1008 Elevator The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, an

weixin_43608553的博客 217

基于Flink的风控系统

可以使用Flink-Stream进行实时数据流的检测和处理,或者使用Flink-Kafka集群进行数据转发和存储,然后使用Flink-Table进行数据表的查询和分析。在Flink中,可以使用Flink-Stream进行数据流的处理,或者使用Flink-Kafka进行Kafka数据流的消费和处理。Flink的运行时本身也支持迭代算法的执行。可以使用Flink-Stream进行实时数据流的检测和处理,或者使用Flink-Kafka集群进行数据转发和存储,然后使用Flink-Table进行数据表的查询和分析。

m0_68231587的博客 1875

深度学习之Pytorch---本人踩过的坑(报错总结)第十篇

深度学习之Pytorch安装时遇到的问题—本人踩过的坑(报错总结) 报错一:pip install torchvision 出现“由于目标计算机积极拒绝,无法连接”的问题 解决方案:找到自己浏览器的工具或选项,我的是火狐,具体解决方案如下图 然后找到桌面左下角,点击搜索internet,然后点击internet选项 最后回到Anaconda Prompt命令行输入pip install...

qq_41570307的博客 1914

1008 Elevator (20 分) Java

坑爹的地方在于连续两次按了同一层的话也是需要多停的 1008 Elevator (20 分) The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to m

weixin_45549192的博客 207

基于深度学习的停车位检测系统(UI界面 + YOLOv8/v7/v6/v5代码 + 训练数据集)

传统的停车位检测方法主要依赖于人工或基于简单图像处理的技术,存在检测速度慢、准确率低、环境适应性差等问题。近年来,随着深度学习技术的快速发展,基于目标检测的停车位检测系统已成为研究的热点。本文基于YOLO(You Only Look Once)系列模型(包括YOLOv5、YOLOv6、YOLOv7和YOLOv8),开发了一个完整的停车位检测系统,支持实时检测、结果可视化以及UI交互界面。本文实现了一个基于深度学习的停车位检测系统,采用YOLO模型在实时视频流中进行高效检测。

YOLO 332

HDU-1008-Elevator(Java版本+简单模拟+恶心水果)

Elevator Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 50645    Accepted Submission(s): 27932 Problem Description The highest bui

保持对编程的热情! 1555

基于NRF52833芯片的DW3000 SPI驱动接口代码实现

详细介绍基于NRF52833、nRF52820 、nRF52832 nRF52840 芯片的DW3000 硬件驱动接口代码

DT程序员的博客 1216

RK3568 RGA硬件加速详解:图像缩放、旋转、格式转换10倍提速

RGA(Raster Graphics Acceleration)是瑞芯微(Rockchip)芯片系列中的 2D 图形加速引擎,专门用于处理像素级的图像操作。它通过硬件实现常见的图像处理算法,解放 CPU,降低功耗。RGA 是 RK3568 平台上一颗强大的 2D 图形加速引擎,能够:✅10-20 倍性能提升:大幅减少图像处理时间✅降低 CPU 占用:释放 CPU 资源给其他任务✅丰富的功能:缩放、旋转、裁剪、格式转换一应俱全✅易于集成:librga 提供简洁的 C API。

小灰灰的博客 1692

杭电Elevator(1008)

Problem Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in spe...

晨暮的博客 354

【AUTOSAR-E2E】-2.1-配置E2E:基于E2EPW配置一个RX接收的Signal Group(使用E2E Profile 2)

《共13页精讲》:此法也适用于E2E Profile 4/5/6/7/11/22 目录 1 检查CAN Matrix Arxml/DBC是否满足E2E需求 2 在DaVinci Developer中为Port添加E2E保护 3 在DaVinci Configurator settings设置 4 如何使用应用层的E2E保护 5 结尾 <--返回「Autosar_BSW高阶配置」总目录--> <--返回「Autosar_BSW高阶配置」专栏主页--> <--

「汽车电子助手」的博客 4417

杭电1008 Elevator

杭电1008 Elevator #include <stdio.h> #include <stdlib.h> int main() { int n; int i,j; int num[101]; ...

weixin_30877181的博客 82

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

杭电 1008 Elevator

杭电ACM 2014暑期集训队——选拔安排~ Elevator Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 40905    Accepted Submission(s): 22387 Proble

逸疏 989

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

杭电acm1008 Elevator

http://acm.hdu.edu.cn/showproblem.php?pid=1008 Elevator Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14982Accepted Submission(s):...

weixin_30549175的博客 153

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

杭电1008 Elevator

Elevator Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 7   Accepted Submission(s) : 5 Font: Times New Roman | Verdana | Georgia Font Siz

笨鸟 912

杭电ACM-1008 Elevator

Elevator Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 36319    Accepted Submission(s): 19791 Problem Description The highest bui

堕落在雨季 1029

Elevator —— 杭电1008

Problem Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one flo

qq_44408319的博客 231

杭电ACM——1008——Elevator

第二次完全自己写并一次OC,不过这个比较简单,过程很顺利 #include < stdio.h > int upward ( int , int ); int down ( int , int ); int main() { int N , request , totaltime; int current; while ( 1 ) { scanf ( "%d" , &...

YANG_LJ_is_ME的博客 413
上一篇: 杭电1005-Number Sequence
下一篇: 杭电1009-FatMouse' Trade(贪心)
Eric_keke
博客等级 码龄12年 37粉丝 221原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值