| ||||||||||
| 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 | |||||||||
Re:vector<string>In Reply To:vector<string> Posted by:xusiwei1236 at 2012-06-14 00:07:57 > #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator