51nod 1018 排序

基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题
 收藏
 关注
给出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


#include <iostream>
#include<string.h>
#include<algorithm>
using namespace std;
const int maxn=5e4+10;
int a[maxn];
int main()
{
    int n;
    cin>>n;
    int j=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int k=0;k<n;k++)
        cout<<a[k]<<endl;
    return 0;
}



原文地址:https://www.cnblogs.com/bryce1010/p/9387200.html