알고리즘/SwExpert recipe

SWEA 숫자를 정렬하자 [D2]

컵라면만두세트 2021. 2. 14. 13:59
package D2;

import java.util.Arrays;
import java.util.Scanner;

public class 숫자를정렬하자 {
	public static void main(String[] args) {
		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);
			int arr2[] = new int[N];
			for(int i =0; i<N; i++) {
				arr2[i] = arr[i];
				
			}
			System.out.print("#" + tc );
			for(int i =0; i<N; i++) {
				System.out.print(" "+arr[i] );
				
			}
			System.out.println(" ");
		}
	}

}

'알고리즘 > SwExpert recipe' 카테고리의 다른 글

SWEA 달팽이숫자 [D2]  (0) 2021.02.15
SWEA 최적경로 [D5]  (0) 2021.02.14
SWEA 가랏RC카 [D2]  (0) 2021.02.13
SWEA 어디에 단어가 들어갈수있을까 [D2]  (0) 2021.02.13
SWEA 초심자의회문검사 [D2]  (0) 2021.02.12