public class Elevator { private static int totalFloorNum = 10; private static int totalStopNum = 4; private static int[] person = new int[totalFloorNum]; private static int[][] floorIndex = new int[totalFloorNum][totalStopNum];
private static int computePeopleStairs(int floor, int stopNum) { int max = totalFloorNum - stopNum;
if (stopNum == 0) { int temp = 0; for (int i = floor + 1; i < max; i++) { temp += person[i] * (i - floor); } return temp; } else { int minPersonStair = Integer.MAX_VALUE; for (int i = floor + 1; i <= max; i++) { int temp = 0; int mid = (floor + i) / 2;