Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

一ac的向来都留个拙代码

Posted by TSERROF at 2012-09-30 00:16:40 on Problem 2013
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator