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.

这是一道关于模拟电梯运行的题目,要求计算在城市最高建筑中,电梯根据特定请求停靠楼层所需的时间。电梯上行速度为6秒一层,下行速度为4秒一层,每停靠一次花费5秒。给定一个包含N个正整数的请求列表,程序需要计算完成这些请求的总时间。案例中,输入包括一个正整数N和N个正整数表示楼层请求,输出为总运行时间。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



