공부하는 히욤이

1966. 숫자를 정렬하자 본문

Algorithm/SW Expert Academy

1966. 숫자를 정렬하자

히욤이 2019. 2. 18. 21:21

SW Expert 1966. 숫자를 정렬하자

문제의 저작권은 SW Expert에 있습니다 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Arrays;
import java.util.Scanner;
 
public class Solution {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int test_case = 1; test_case <= t; test_case++) {
 
            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("#" + test_case +" ");
            for (int i = 0; i < arr.length; i++) {
                System.out.print(arr[i]+" ");
            }
        }
    }
}
cs