2 solutions
-
0
#include<bits/stdc++.h> using namespace std; int q[105],f,r; void ps(int x){ q[r]=x; r++; } void pp(){ f++; } int gf(){ return q[f]; } int sz(){ return r-f; } int main(){ int n,x; cin>>n; f=0;r=0; for(int i=1;i<=n;i++){ cin>>x; ps(x); } int k=1; while(sz()!=0){ if(k%2==1){ cout<<gf()<<" "; pp(); }else{ ps(gf()); pp(); } k++; } return 0; }
Information
- ID
- 1869
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 5
- Tags
- # Submissions
- 33
- Accepted
- 15
- Uploaded By