fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. vector<int> a;
  8.  
  9. int main(){
  10. int n,x;
  11. cin >> n;
  12. for(int i=0; i<n; i++) {
  13. cin >> x;
  14. a.push_back(x);
  15. }
  16. sort(a.rbegin(), a.rend());
  17. for(int i=0; i<a.size(); i++)
  18. cout << a[i] << ' ';
  19. return 0;
  20. }
Success #stdin #stdout 0s 3436KB
stdin
5
1 6 3 2 5
stdout
6 5 3 2 1