SHARE
TWEET

Problem-D Изменение порядка списка

kananasgarli90 Jun 6th, 2020 812 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     deque<int>dq;
  6.     int n, a;
  7.     cin>>n;
  8.     while(n--){
  9.         cin>>a;
  10.         dq.push_back(a);
  11.     }
  12.  
  13.     while(dq.size() != 0){
  14.  
  15.         cout<<dq.front()<<" ";
  16.         dq.pop_front();
  17.  
  18.         if(dq.size() != 0){
  19.             cout<<dq.back()<<" ";
  20.             dq.pop_back();
  21.         }
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top