题解 | #排序#
排序
https://www.nowcoder.com/practice/508f66c6c93d4191ab25151066cb50ef
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; const int MAX=110; int arr[MAX]; int main() { int n; while (scanf("%d",&n)!=EOF) { for(int i=0;i<n;++i) scanf("%d",&arr[i]); sort(arr,arr+n); for(int i=0;i<n;++i) printf("%d ",arr[i]); printf("\n"); } return 0; } //sort函数 sort(arr,arr+n,comp) //#include<algorithm>