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 n, i, j;
int arr[] = new int [101];
int tmp;
n = scan.nextInt();
for (i = 0; i < n; i++) {
arr[i]= scan.nextInt();
}
for (i = 0; i < n - 1; i++) {
for (j = 0; j < n - 1; j++) {
if (arr[j] > arr[j + 1]) {
tmp = arr[j + 1];
arr[j + 1] = arr[j];
arr[j] = tmp;
}
}
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=437&sca=2070
'정올문제소스코드' 카테고리의 다른 글
1221 : 후위표기법1 (0) | 2021.12.05 |
---|---|
1814 : 삽입정렬 횟수 세기 (0) | 2021.12.05 |
1158 : 삽입정렬 (0) | 2021.12.05 |
1146 : 선택정렬 (0) | 2021.12.05 |
1697 : 큐(queue) (0) | 2021.10.31 |