jhjj
2024-07-05 19:01:25
发布于:广东
1阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int a[110],n;
int main () {
cin >> n;
for (int i = 1;i <= n;i++) {
cin >> a[i];
}
for(int i = 1;i <= n-1;i++) {
if (a[i+1] < a[i]) {
swap(a[i+1],a[i]);
}
}
for (int p = 1;p <= n;p++) {
cout << a[p] << " ";
}
return 0;
}
这里空空如也
有帮助,赞一个