SWEA

swea 1966 [D2] 숫자를 정렬하자 JAVA

녁이 2023. 11. 20. 20:23
728x90
반응형

풀이 :

오름차순 정렬 -> sort

 


Code

public class Solution1966 {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();

        for (int tc = 1; tc <= T; tc++) {
            int N = sc.nextInt();
            int[] arr = new int[N];

            for(int i = 0; i < N; i++) {
                arr[i] = sc.nextInt();
            }

            Arrays.sort(arr);
            System.out.print("#" + tc + " ");
            for (int i = 0; i < arr.length; i++) {
                System.out.print(arr[i] + " ");
            }
            System.out.println();
        }
    }
}
728x90
반응형