-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboj_2750.java
More file actions
35 lines (28 loc) · 878 Bytes
/
boj_2750.java
File metadata and controls
35 lines (28 loc) · 878 Bytes
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
26
27
28
29
30
31
32
33
34
35
package sorting;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class boj_2750 {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int N=Integer.parseInt(br.readLine());//배열 크기 입력받음
int[] arr=new int[N]; //배열 생성
for(int i=0;i<N;i++){
arr[i]=Integer.parseInt(br.readLine());
}
//선택 정렬 사용
for(int i=0;i<N-1;i++){
for(int j=i+1;j<N;j++){
if(arr[i]>arr[j]){
int temp=arr[j];
arr[j]=arr[i];
arr[i]=temp;
}
}
}
//출력
for(int val: arr){
System.out.println(val);
}
}
}