翻译

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, 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.

输入:

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.

输出:

Print the total time on a single line for each test case.
 
翻译:
电梯
描述:
在我们的城市中最高的建筑只有一个电梯。一个由N个正整数组成的请求列表。这些数字表示电梯按照规定顺序停止的层数。电梯上一层要6秒,下一层要4秒。电梯每次停留5秒。
对于给定的请求列表,你是去计算完成这个列表上的请求的全部时间。电梯一开始在0层,当请求被满足时不用返回底层。
输入:
有多种测试情况。每种情况都包含一个正整数N,跟着N个正整数。N=0的测试情况表示输入结束。这个测试情况不用处理。
输出:
打印每种测试情况的全部时间在一行上。
 
posted @ 2022-01-20 23:54  zgsycbq  阅读(174)  评论(0)    收藏  举报