#include <iostream>
using namespace std;

int main() {
	// your code goes here
		int n = 5;
	int a[5] = {4, 3, 5, 1, 2};
	int t, i, j, k;
	
	for (i = 1; i < n; i++) {
		for (k = 0; k < n; k++)
		cout << a[k] << " ";
		cout << endl;
		
		for (j = 0; j < n - i; j++) {
			if (a[j] < a[j+1]) {
				t = a[j];
				a[j] = a[j+1];
				a[j+1] = t;
			}
		}
	}
	
	cout << "排序好的陣列為 " << endl;
	for (i = 0; i < n; i++)
		cout << a[i] << " ";
	return 0;
}