博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1008. Elevator (20)
阅读量:5291 次
发布时间:2019-06-14

本文共 1476 字,大约阅读时间需要 4 分钟。

 

时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue

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 Specification:

Each input file contains one test case. Each case contains a positive integer N, followed by N positive numbers. All the numbers in the input are less than 100.

Output Specification:

For each test case, print the total time on a single line.

Sample Input:
3 2 3 1
Sample Output:
41
#include
4 5 int main() 6 { 7 8 int n,i,tem; 9 while(scanf("%d",&n)!=EOF)10 {11 int index= 0;12 int sum = 0;13 for(i= 0;i
0)18 {19 sum += dis * 6;20 }21 else22 {23 sum -= dis * 4;24 }25 26 sum += 5;27 index = tem ;28 }29 30 printf("%d\n",sum);31 }32 return 0;33 }

 

转载于:https://www.cnblogs.com/xiaoyesoso/p/4277110.html

你可能感兴趣的文章
SQL高级查询技巧(两次JOIN同一个表,自包含JOIN,不等JOIN)
查看>>
难搞的EXCHANGE重新安装错误
查看>>
认识hasLayout
查看>>
MyISAM InnoDB 区别
查看>>
TibetanFont | ཡིག་གཟུགས། | 藏文字体
查看>>
mac系统下mysql5.7.13数据库编码查看和设置
查看>>
cocurrent包 原子性数据类型
查看>>
[vijos1049] 送给圣诞夜的礼品
查看>>
Codeforces 940F Machine Learning (带修改莫队)
查看>>
Jenkins Pipline语法
查看>>
Linux useradd -M -s
查看>>
define
查看>>
使用DD 创建SWAP
查看>>
【笔记篇】Ubuntu一日游
查看>>
.NET CORE 第二节 中间件的原理和自定义中间件
查看>>
开放有限元分析计算平台介绍
查看>>
Python中的函数
查看>>
静态路由和动态路由
查看>>
为C1Chart for WPF添加自定义标题、坐标轴单位标签以及旋转坐标轴注释
查看>>
51job_selenium测试
查看>>