You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
356 B
28 lines
356 B
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
int main() {
|
|
int s,n,j,i=0;
|
|
scanf("%d",&n);
|
|
int a[n];
|
|
s=n;
|
|
while(s--) {
|
|
scanf("%d",&a[i++]);
|
|
}
|
|
//一维数组排序
|
|
for(i=0; i<n-1; i++) {
|
|
for(j=i+1; j<n; j++)
|
|
if(a[i]>a[j]) {
|
|
int t=a[i];
|
|
a[i]=a[j];
|
|
a[j]=t;
|
|
}
|
|
}
|
|
//输出一维数组
|
|
for(i=0; i<n; i++)
|
|
printf("%d ",a[i]);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|