解题思路:
送分题。
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int time = n*5;
int lastFloor = 0;
for(int i=0; i<n; i++) {
int floor = input.nextInt();
if(floor > lastFloor) time += (floor - lastFloor) * 6;
if(floor < lastFloor) time += (lastFloor - floor) * 4;
lastFloor = floor;
}
System.out.print(time);
input.close();
}
}