fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int n;
  6. long long a[200005];
  7.  
  8. int main(){
  9. cin >> n;
  10. for (int i = 1; i <= n; i++){
  11. cin >> a[i];
  12. }
  13. for (int i = 1; i <= (n+1)/2; i++){
  14. if (i%2) swap(a[i], a[n-i+1]);
  15. }
  16. for (int i = 1; i <= n; i++){
  17. cout << a[i] << " ";
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 16800KB
stdin
8
6 1 4 2 5 6 9 2
stdout
2 1 6 2 5 4 9 6