51nod 1018排序

给出N个整数,对着N个整数进行排序

Input
第1行:整数的数量N(1 <= N <= 50000)
第2 - N + 1行:待排序的整数(-10^9 <= A[i] <= 10^9)
 
Output
共n行,按照递增序输出排序好的数据。
 
Input示例
5
5
4
3
2
1
 
Output示例
1
2
3
4
5

从大到小排序
 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int a[50050];
 4 int main(){
 5     int n;
 6     scanf("%d",&n); 
 7     memset(a,0,sizeof(a));   
 8     for(int i=0;i<n;i++)
 9         scanf("%d",&a[i]);
10     sort(a,a+n);
11     for(int i=0;i<n;i++)
12         printf("%d
",a[i]);
13     return 0;
14 } 



原文地址:https://www.cnblogs.com/z-712/p/7382613.html