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

vector<string>

Posted by xusiwei1236 at 2012-06-14 00:07:57 on Problem 3750
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
vector<string> list;
int main()
{
	int n,w,s;	
	string name;
	cin >> n;
	for(int i=0; i<n; i++) {		
		cin >> name;
		list.push_back(name);
	}	
	scanf("%d,%d", &w, &s);
	int idx = w-1;
	while (list.size()) {
		idx = (idx + s-1) % list.size();
		cout << list[idx] <<endl;
		list.erase(list.begin() + idx);
	}
	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