代码
#include<iostream>
#include
<algorithm>
using namespace std;
int a[3000001];
/*
bool cmp(int a, int b)
{
return a>b; //a>b为从大到小,sort默认从小到大
}
*/
int main ()
{
int nCase,i;
while(scanf("%d", &nCase)+1)
{
int t=nCase;
while(t--) scanf("%d",&a[t]);
// sort(a,a+nCase,cmp); 此条需要cmp函数
sort(a,a+nCase);
for(i=0;i<nCase-1;i++) printf("%d ",a[i]);
printf(
"%d\n",a[i]);
}
return 0;
}

相关文章:

  • 2021-11-21
  • 2021-11-21
  • 2021-07-25
  • 2021-11-11
  • 2022-12-23
猜你喜欢
  • 2021-11-21
  • 2022-02-08
  • 2021-07-06
  • 2022-12-23
  • 2022-01-20
  • 2021-11-21
相关资源
相似解决方案