HDACM1008
先算停的所有时间和,在判断电梯是上还是下,每上走一层就+6,每下一层就+4
import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc = new Scanner(System.in);while (sc.hasNext()) {int n = sc.nextInt();if (n==0) {break;}int time = 5*n;int b =0;while (n-->0) {int a = sc.nextInt();if (a-b>0) {time += (a-b)*6;}else {time += (b-a)*4;}b=a;}System.out.println(time); }}
}