Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
34734 | A21μΘ_wjy | 【S】T1 | C++ | 通过 | 100 | 219 MS | 4376 KB | 724 | 2024-11-14 14:27:36 |
#include<bits/stdc++.h> using namespace std; int n; deque<int> D; signed main(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #ifndef ONLINE_JUDGE freopen("reverse.in","r",stdin); freopen("reverse.out","w",stdout); #endif cin>>n; for(int i=1;i<=n;i++){ int x;cin>>x; if(i&1)D.push_back(x); else D.push_front(x); } if(n&1){ while(!D.empty()){ cout<<D.back()<<" "; D.pop_back(); } cout<<endl; return 0; } else{ while(!D.empty()){ cout<<D.front()<<" "; D.pop_front(); } cout<<endl; return 0; } cout.flush(); }