ustbfym 2019-12-17
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int a[54545]; int main() { int n; scanf("%d",&n); for(int i = 1;i <= n;i ++) scanf("%d",&a[i]); for(int i = 1;i < n;i ++) for(int j = n;j > i;j --) if(a[j] < a[j-1]) swap(a[j],a[j-1]); for(int i = 1;i <= n;i ++) printf("%d ",a[i]); return 0; }
# 第三题:使用python实现冒泡排序def BubbleSort: long = len for i in range: for j in range: if list[i] < list[j]: