#include<iostream> #include<cstring> #define N 100000+10 using namespace std; int a[N],n,s; int main() { cin>>n; for(int i=1;i<=n;i++){ cin>>s; a[s]++; } for(int i=1;i<N;i++) if(a[i]) for(int j=1;j<=a[i];j++)cout<<i<<" "; cout<<endl; }
#include<iostream> #include<cstring> #define N 100000+10 using namespace std; int a[N],n,s; int main() { cin>>n; for(int i=1;i<=n;i++){ cin>>s; a[s]++; } for(int i=1;i<N;i++) if(a[i]) for(int j=1;j<=a[i];j++)cout<<i<<" "; cout<<endl; }
转载于:https://www.cnblogs.com/jzxnl/p/11070373.html