fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cin >> n;
  8.  
  9. long long a[100005];
  10.  
  11. for(int i = 0;i <= n; i++)
  12. cin >> a[i];
  13.  
  14. int l = 0, r = n - 1;
  15.  
  16. while (l <= r) {
  17. cout << a[l] << " ";
  18. l++;
  19.  
  20. if (l <= r) {
  21. cout << a[r] << " ";
  22. r--;
  23. }
  24. }
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty