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轻松AC~#include <cstdio> #include <cstdlib> #include <iostream> #include <vector> using namespace std; struct NOTE { int num; char name[70]; }; vector<NOTE> map; int n,w,s; void read() { NOTE tmp; scanf("%d",&n); for(int i=1;i<=n;i++) { tmp.num=i; scanf("%s",tmp.name); map.push_back(tmp); } scanf("%d,%d",&w,&s); } void numberoff() { int tmp=w-1; while(!map.empty()) { tmp=(1+tmp+s-2)%map.size(); printf("%s\n",map[tmp].name); map.erase(map.begin()+tmp); } } int main() { read(); numberoff(); system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator