eolymp
bolt
Try our new interface for solving problems
Problems

Cards game 2

published at 2/6/24, 10:29:02 am

include <bits/stdc++.h>

define ll long long int

define ld long double

using namespace std; int main(){

ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
vector<ll>v(n);
for(int i = 0; i<n; i++){
    cin>>v[i];
}
if(n%2 == 0){
    for(int i = 0; i<n/2; i++){
        cout<<v[i]<<' '<<v[n - i- 1]<<' ';
    }
    return 0;
}
for(int i = 0; i<n/2; i++){
    cout<<v[i]<<' '<<v[n - i- 1]<<' ';
}
cout<<v[n/2];

} //TECHNOBLADE NEVER DIES