fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <iterator>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. int main() {
  8. int n;
  9. cin >> n;
  10. vector<int> v(n);
  11. for (auto& e : v)
  12. cin >> e;
  13.  
  14. copy(v.rbegin(), v.rend(), ostream_iterator<int>(cout, " "));
  15. cout << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3472KB
stdin
5
1 2 3 4 5
stdout
5 4 3 2 1