import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int i, j, n;
int arr[] = new int [101];
int big = 0;
n = scan.nextInt();
for (i = 0; i < n; i++) {
arr[i] = scan.nextInt();
}
for (i = 0; i < n-1; i++) {
int small = arr[i];
int pos = i;
for (j = i; j < n; j++) {
if (small > arr[j]) {
small = arr[j];
pos = j;
}
}
int c = arr[i];
arr[i] = arr[pos];
arr[pos] = c;
for (j = 0; j < n; j++) {
System.out.printf("%d ", arr[j]);
}
System.out.printf("\n");
}
}
}
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=426&sca=2070
'정올문제소스코드' 카테고리의 다른 글
1157 : 버블정렬 (0) | 2021.12.05 |
---|---|
1158 : 삽입정렬 (0) | 2021.12.05 |
1697 : 큐(queue) (0) | 2021.10.31 |
1102 : 스택 (stack) (0) | 2021.10.31 |
1761 : 숫자 야구 (0) | 2021.10.29 |