Elevator

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

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

 
Author
ZHENG, Jianqiang
 
Source
 
        看到有人说没看懂题目= =呃..这真的是高中英语的问题了....
        题目大意是我要坐电梯,给你一个列表,上面有N个正整数,代表电梯要按顺序去的楼层,上楼6分钟,下楼4分钟,每个指定的楼层还要停5分钟,问总共需要多少分钟呢?注意初始在第0层。
        很简单,在线模拟就好了。先算出总共停留的时间5*N,然后判断上楼*6,下楼*4。
        题目没说相邻楼层相同的情况,不管它。
 #include <stdio.h>
int main() {
int N, arr[]={};
while(scanf("%d", &N), N) {
int res=*N, t;
for(int i=; i<=N; i++) {
scanf("%d", arr+i);
t=arr[i-]-arr[i];
res+=arr[i-]<arr[i]?-t*:t*;
}
printf("%d\n", res);
}
return ;
}

HDOJ 1008. Elevator 简单模拟水题的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. POJ 2014:Flow Layout 模拟水题

    Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Descr ...

  3. HDOJ(HDU) 1859 最小长方形(水题、、)

    Problem Description 给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内.长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内 ...

  4. HDOJ/HDU 2560 Buildings(嗯~水题)

    Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...

  5. 2019年华南理工校赛(春季赛)--I--炒股(简单思维水题)

    水题,想想就过了 题目如下: 链接:https://ac.nowcoder.com/acm/contest/625/I来源:牛客网 攒机一时爽,一直攒机一直爽. 沉迷攒机的胡老师很快就发现,他每天只能 ...

  6. PAT 甲级 1008 Elevator (20)(20 分)模拟水题

    题目翻译: 1008.电梯 在我们的城市里,最高的建筑物里只有一部电梯.有一份由N个正数组成的请求列表.这些数表示电梯将会以规定的顺序在哪些楼层停下.电梯升高一层需要6秒,下降一层需要4秒.每次停下电 ...

  7. Hdoj 1008.Elevator 题解

    Problem Description The highest building in our city has only one elevator. A request list is made u ...

  8. 模拟水题,查看二维数组是否有一列都为1(POJ2864)

    题目链接:http://poj.org/problem?id=2864 题意:参照题目 哈哈哈,这个题discuss有翻译哦.水到我不想交了. #include <cstdio> #inc ...

  9. hdoj 1008 Elevator

    Elevator Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

随机推荐

  1. DDD 领域驱动设计-谈谈 Repository、IUnitOfWork 和 IDbContext 的实践(2)

    上一篇:<DDD 领域驱动设计-谈谈 Repository.IUnitOfWork 和 IDbContext 的实践(1)> 阅读目录: 抽离 IRepository 并改造 Reposi ...

  2. [摘录]第三部分 IBM文化(2)

    第二十二章 原则性领导 在一个组织程序已经变得不受其来源和内容的约束,而且其编纂出来的组织宗旨已经代替了个人责任的组织之中,你所面临的首要任务,就是要全盘抹掉这个程序本身,以便让整个封闭的系统呼吸新鲜 ...

  3. 读书笔记--SQL必知必会01--了解SQL

    1.1 数据库基础 数据库(datebase) 保存有组织的数据的容器(通常是一个文件或一组文件),是一个以某种有组织的方式存储的数据集合. 数据库管理系统(DBMS,Data Base Manage ...

  4. OWIN与Katana详解

    前言 我胡汉三又回来了,!!!!, 最近忙成狗,实在没空写博文,实在对不起自己,博客园上逛了逛发现 我大微软还是很给力的 asp.net core 1.0 .net core 1.0 即将发布,虽然. ...

  5. golang 使用 iota

    iota是golang语言的常量计数器,只能在常量的表达式中使用. iota在const关键字出现时将被重置为0(const内部的第一行之前),const中每新增一行常量声明将使iota计数一次(io ...

  6. 几道web前端练习题目

    在 HTML 语言中,以下哪个属性不是通用属性?A]<class>B]<title>C]<href>D]<style> 在线练习:http://hove ...

  7. 初学DDD-领域驱动设计

    这几天刚开始学习DDD,看了几篇大神的文章,现在只是知道了几个名词,还没有详细的学习.结合自己的工作经历,说说自己的看法,请各位大神多多指点. 最开始用的比较多的是以数据库表建立模型驱动开发.后来发现 ...

  8. A2W、W2A、A2T、T2A的使用方法

    1.A2W和W2A 在<Window核心编程>,多字节和宽字节之间转换比较麻烦的,MultiByteToWideChar函数和WideCharToMultiByte函数有足够多的参数的意义 ...

  9. GJM : Unity3D HIAR -【 快速入门 】 八、开发云识别应用

    开发云识别应用 为了解决识别图片数量限制,以及上线应用不能动态修改识别图片和 AR 内容的问题,我们在 HiAR SDK for Unity 新版本(v1.1.x 及后续版本)中集成了云识别功能.本文 ...

  10. 怎样在asp中产生10个0-99的随机数

    <% randomize for i=1 to 10 response.write cint(rnd*100) next %> randomize是随机初始化,使用rnd之前必须要先来一句 ...