logo AlgoBeat OnlineJudge
登录 注册

题解

作者: _ZXY_  ·  发布于 2026-05-26 21:07:54  ·  最后修改于 2026-05-27 22:49:13
已通过
审核员:AlgoBeat 官方账号 · 2026-05-27 22:49:13

STL 中有一个函数——sort。
它的作用是将数列排序。
使用方法,sort(首指针,尾指针)。

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

暂无评论

登录 后即可评论。