这样写更简洁 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = 100, res = 0; int n = sc.nextInt(); int p = sc.nextInt(); int q = sc.nextInt(); int[] scores = new int[n]; for (int i = 0; i < n; i++) scores[i] = sc.nextInt(); Arrays.sort(scores); for (int i = n - 1; i >= 0; i--) { if (i < n - 1 && scores[i] < scores[i + 1]) num--; double sum = (p * num + q * scores[i]) / 100; if (sum >= 60) res++; } System.out.println(res); } }