logo AlgoBeat OnlineJudge
登录 注册

题解

作者: tyxx040105  ·  发布于 2026-08-24 8:30:01  ·  最后修改于 2026-08-25 15:30:54
已通过
审核员:AlgoBeat 官方账号 · 2026-08-25 15:30:54

直接使用 STL 中的 sort 函数排序即可。

代码:

#include<bits/stdc++.h>
using namespace std;
int a[100005],n;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++) cout<<a[i]<<" ";
    return 0;
}

暂无评论

登录 后即可评论。