Advertisement
cupsamada

#corigenta

Dec 4th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int v[1005];
  4. int main()
  5. {
  6. int n, i, st, dr;
  7. cin>>n;
  8. for(i=1; i<=n; i++)
  9. {
  10. cin>>v[i];
  11. }
  12. st=1;
  13. dr=n;
  14. for(i=1; i<=n; i++)
  15. {
  16. if(i%2!=0)
  17. {
  18. cout<<v[st++]<<" ";
  19. }
  20. else
  21. {
  22. cout<<v[dr--]<<" ";
  23. }
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement