第五题我自己的测试都过了 但是上面就是过不去😪 public class Main5 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int o = 0; o < t; o++) { int n = in.nextInt(); int m = in.nextInt(); int[] nums = new int[n]; int max_money = 0; for (int i = 0; i < n; i++) { nums[i] = in.nextInt(); max_money += nums[i]; } if (max_money % m == 0) { System.out.println(0); }else{ int have = max_money % m; Arrays.sort(nums); int k=0; for (k = 0; k < max_money; k++) { if (search(nums,have+k*m)){ break; } } System.out.println(have+k*m); } } }