Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int hit = sc.nextInt(); int time = sc.nextInt(); int[] nums = new int[n]; for (int i = 0; i < n; i++) { int temp = sc.nextInt(); nums[i] = temp % hit == 0 ? temp / hit : temp / hit + 1; } Arrays.sort(nums); int i = 0; while (time > 0) { time = time - nums[i]; i++; } System.out.println(i); 我这个只过了40%,实在是不知道哪里有问题了,案例是可以通过的