标签:pat
1.链接:http://www.patest.cn/contests/mooc-ds/07-排序1
2.代码:
#include<cstdio> #include<algorithm> #include<iostream> using namespace std; int cmp(int a,int b) { return a<b; } int a[100005]; int main() { int n; while(scanf("%d",&n)==1) { for(int i=0; i<n; i++) scanf("%d",&a[i]); sort(a,a+n); for(int i=0; i<n; i++) { if(i==n-1) printf("%d\n",a[i]); else printf("%d ",a[i]); } } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:pat
原文地址:http://blog.csdn.net/xky1306102chenhong/article/details/47764403