Advertisement
Infiniti_Inter

page 89 1 chapter (90 problem 20)

Mar 19th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. #define Line cout << endl << "-------------------------------------------\n\n"
  7. #define forn(i, n) for(int i = 0; i < int(n);i++)
  8. const int INF = 1e9 + 13;
  9. const int N = 1e5 + 13;
  10.  
  11.  
  12. int main(){
  13.     int n; cin >> n;
  14.     vector<int> a(n);
  15.     forn(i, n)
  16.         cin >> a[i];
  17.     for(vector<int>::iterator it = a.begin(); it != a.end(); it++)
  18.         {
  19.             vector<int>::iterator tmp = it;
  20.             iter_swap(it++, ++tmp);
  21.         }
  22.     forn(i, n)
  23.         cout << a[i] << ' ';
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement