A1008 Elevator (20分)【C语言】
to记录要去的楼层,now记录当前所处楼层,根据to和now的大小关系判断上楼、下楼还是停留在当前楼层(不需要上下楼时间,但要计算停留时间)。
题目描述:
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.
输入格式:
Each input file contains one test case. Ea