Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
一ac的向来都留个拙代码#include <iostream> #include <string> #include <vector> using namespace std; int main() { int N; int c=1; while(cin>>N && N) { vector<string>num; string temp; for(int i=1;i<=N;++i) { cin>>temp; num.push_back(temp); } vector<string>ans; ans.resize(N); int cnt=0; for(int i=0;i<N;i+=2) ans[cnt++]=num[i]; cnt=N-1; for(int i=1;i<N;i+=2) ans[cnt--]=num[i]; cout<<"SET "<<c++<<endl; for(unsigned int i=0;i<N;++i) cout<<ans[i]<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator