全是RE是为什么
查看原帖
全是RE是为什么
1363425
Haste楼主2024/6/7 00:23
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc1 = new Scanner(System.in);
        int n = sc1.nextInt();
        Scanner sc2 = new Scanner (System.in);
        String medal = sc2.nextLine();
        String[] medalarr = medal.split(" ");
        int[] numberarr = new int[7];
        for (int i = 0; i < 7; i++) {
            numberarr[i]=Integer.parseInt(madelarr[i]);
        }
        Scanner sc3 = new Scanner(System.in);
        int[] jiang = new int[7];
        for (int i = 0; i < n; i++) {
            String buy = sc3.nextLine();
            String[] buyarr = buy.split(" ");
            int[] arr = new int[7];
            int count =7;
            for (int j = 0; j < 7; j++) {
                arr[j]=Integer.parseInt(buyarr[j]);
                boolean re =justice(numberarr,arr[j]);
                if(re){
                    count--;
                }
            }
            if(count<=6){
                jiang[count]++;
            }
        }
        for (int i = 0; i < jiang.length; i++) {
            System.out.print(jiang[i]+" ");
        }
    }
    public static boolean justice(int[] arr,int n){
        boolean flag=false;
        for (int i = 0; i < arr.length; i++) {
            if(n==arr[i]){
                flag=true;
                break;
            }
        }
        return flag;
    }
}
2024/6/7 00:23
加载中...