-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJ02012
28 lines (26 loc) · 812 Bytes
/
J02012
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
package test;
import java.util.Scanner;
public class J02012 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++)
a[i] = sc.nextInt();
for (int i = 0; i < n; i++) {
for (int j = 0; j <= i; j++) {
for (int k = i; k > j; k--) {
if (a[k] < a[k - 1]) {
int x = a[k];
a[k] = a[k - 1];
a[k - 1] = x;
}
}
}
System.out.printf("Buoc %d: ", i);
for (int j = 0; j <= i; j++)
System.out.printf("%d ", a[j]);
System.out.println();
}
}
}