fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. using ll = long long;
  4. const int MAXN = 1e6;
  5. int a[MAXN];
  6. int main(){
  7. ll n;
  8. cin >> n;
  9. for( int i = 1 ; i<= n ; i++ ) cin >> a[i];
  10. sort( a+1 , a+n+1 , greater<int>());
  11. for ( int i = 1 ; i<= n ; i++ ) cout << a[i] << " ";
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 5256KB
stdin
5
2 3 1 4 5
stdout
5 4 3 2 1