描述:
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个正数组成.数字代表着电梯会停留的楼层.电梯移动一个楼层需要6s并且会在每个楼层停留5s.
现在给定一个请求列表,你需要计算完成请求列表的总时间.电梯从0层开始并且在满足请求后不必返回到1楼
输入:有多个测试样例.每个样例有一个正整数N,在N之后接下来有N个正数.所有输入的数字不大于100.当N=0的一个测试样例标记为输入结束,这个测试样例不会被读取.
输出:在单独一行输出每个测试样例的总时间