/* * POJ_3750.cpp * * Created on: 2013年10月30日 * Author: Administrator */ #include <iostream> #include <cstdio> using namespace std; const int maxn = 70; int main(){ char name[maxn][maxn];//小孩名字 int p[maxn];//小孩序号 int n; scanf("%d",&n); int i; for(i = 0 ; i < n ; ++i){ p[i] = i; scanf("%s",&name[i]); } int w,s; scanf("%d,%d",&w,&s); w = (w + n - 1 )%n;//出发位置 do{ w = (w + s - 1)%n;//出列位置 cout<<name[p[w]]<<endl; int j; for(j = w ; j < n - 1 ; ++j){//将出列位置后元素向前移动 p[j] = p[j+1]; } }while(--n); }