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 |
vector<string>#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