为啥Java一直MLE
查看原帖
为啥Java一直MLE
1586325
Eren_Yeagerr楼主2024/12/25 14:01

为啥Java一直MLE

import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int [] tong = new int[n+1];
        for (short i = 0; i < m; i++) {
            tong[sc.nextInt()]++;
        }
        for (short i = 0; i < n+1; i++) {
            while (tong[i]-- > 0) {
                System.out.print(i+" ");
            }
        }
    }
}
2024/12/25 14:01
加载中...