Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Code Written by : John Nixon
- // Date: 09:09:2022 Time: 19:07:58
- // Copyrights are applicable
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define vi vector<int>
- #define vll vector<long long int>
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- std::ios::sync_with_stdio(false);
- int n, num;
- cin >> n;
- vi arr;
- for (int i = 0; i < n; i++)
- {
- cin >> num;
- arr.push_back(num);
- }
- int curr, tmp;
- for (int i = 0; i < n ; i += 2 )
- {
- curr = arr[n - 1];
- for (int j = n - 2; j >= i; j--)
- {
- arr[j + 1] = arr[j];
- }
- arr[i] = curr;
- }
- for (auto num : arr)
- {
- cout << num << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement