a53

revector

a53
Feb 16th, 2022 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. int a[n+1],b[n+1];
  9. for(int i=1;i<=n;++i)
  10. cin>>a[i];
  11. int k=0;
  12. for(int i=1,j=n;k<=n;++i,--j)
  13. {
  14. b[++k]=a[i];
  15. if(k<=n)
  16. b[++k]=a[j];
  17. }
  18. for(int i=n;i>0;--i)
  19. cout<<b[i]<<' ';
  20. cout<<'\n';
  21. return 0;
  22. }
  23.  
Add Comment
Please, Sign In to add comment