#include <iostream>
#include <vector>
using namespace std;
void solve(){
int n;
cin >> n;
vector<double> a(n);
for(auto &i: a) cin >> i;
for(int i = 1; i < n; i += 2) cout << a[i] << " ";
for(int i = 0; i < n; i += 2) cout << a[i] << " ";
}
int main(){
solve();
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <vector>
using namespace std;
void solve(){
int n;
cin >> n;
vector<double> a(n);
for(auto &i: a) cin >> i;
for(int i = 1; i < n; i += 2) cout << a[i] << " ";
for(int i = 0; i < n; i += 2) cout << a[i] << " ";
}
int main(){
solve();
}