返回小组 开始 2024-08-06 14:50:00

8月6日结营测试

结束 2024-08-06 16:55:00
Contest is over.
当前 2024-11-10 00:16:10

6

include <stdio.h>

int main() {

int n, q;
q = 0;
scanf("%d", &n);
int a[n];
for (int i = 0; i < n; i++) {
	scanf("%d", &a[i]);
}
for (int i = 0; i < n - 1; i++) {
	q = 0;
	for (int j = 0; j < n - 1 - i; j++) {
		if (a[j] < a[j + 1]) {
			int t = a[j];
			a[j] = a[j + 1];
			a[j + 1] = t;
			q++;
		}
	}
	if (q != 0) {
		for (int i = 0; i < n; i++) {
			printf("%d ", a[i]);
		}
		printf("\n");
	}
}
return 0;

}


WZCWZC  •  3个月前

比赛已结束。