-->
当前位置:首页 > 题库

PROGRAMMING:Elevator of science and education building

Luz5年前 (2021-05-10)题库439
The elevator in the science and education building of Guangxi University of science and technology is old and broken. Now only one elevator can work normally. Suppose that it takes 6 seconds for the elevator to move up one floor and 4 seconds for the elevator to move down one floor, and each station stays for 8 seconds for passengers to enter and leave. Now, given the list of requests, it is composed of n positive integers. The number represents the floor where the elevator stops in turn. For a given list of requests, you need to calculate the time it takes to complete all requests. Suppose that the elevator starts at the 0 th floor and does not have to return to the bottom floor after completing the request.
###Input format:
Each input includes a test case. Each test case first inputs the number of requests n, followed by a sequence of N integers. All numbers are less than 100.
###Output format:
For each set of inputs, output the time taken to complete the request on a single line.
###Input example:
Here is a set of inputs. For example:
```in
3 2 3 1
```
###Output example:
The corresponding output is given here. For example:
```out
fifty
```







answer:If there is no answer, please comment