fork download
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <sstream>
  7. using namespace std;
  8.  
  9. int main() {
  10. int length;
  11. cin >> length;
  12. int numbers[length];
  13.  
  14. string myStr;
  15. getline(cin, myStr);
  16.  
  17. stringstream stream(myStr);
  18. int temp = 0;
  19. while(stream.good() && temp < length) {
  20. stream >> numbers[temp];
  21. temp++;
  22. }
  23.  
  24. for(int i = length-1; i >= 0; i--) {
  25. cout << numbers[i] << ' ';
  26. }
  27.  
  28.  
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 4300KB
stdin
5
1 2 3 4 5
stdout
1032619120 0 0 0 0