BackJoon Algorithm - Java
문제
풀이
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Back_2750 {
public static void main(String[] args) throws IOException {
// given
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int N = Integer.parseInt(br.readLine());
int arr[]=new int[N];
// when
for(int i=0;i<N;i++){
arr[i]=Integer.parseInt(br.readLine());
}
Arrays.sort(arr); // 오름차순 정렬
// then
for(Integer i: arr){
sb.append(i);
sb.append("\n");
}
System.out.println(sb);
}
}
댓글남기기