劳资不行了,救命~~~
查看原帖
劳资不行了,救命~~~
1091848
封禁用户楼主2024/7/9 16:57

劳资不行了,救命啊~~~

#include <bits/stdc++.h>
using namespace std;
int n, a[100001];
void pai() {
	for (int i = 1; i <= n; i++)
		for (int j = 1; j < n; j++)
			if (a[j] > a[j + 1])
				swap(a[j], a[j + 1]);
}
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	pai();
	for (int i = 1; i <= n; i++)
		cout << a[i] << ' ';
	return 0;
}

各位大佬救救萌新啊!!!

2024/7/9 16:57
加载中...