#include<cstdio> using namespace std; struct T{ int f;//方向 char name[15]; }p[100010]; int main(){ int n,m,top=1;//top当前编号 scanf("%d%d",&n,&m); for(int i=1;i<=n;i++){ scanf("%d%s",&p[i].f,&p[i].name); } for(int i=1;i<=m;i++){ int a,s; scanf("%d%d",&a,&s); if(p[top].f+a==1) top+=s; else top-=s; if(top>n) top-=n; if(top<0) top+=n; } printf("%s",p[top].name); return 0; }
全部评论
(1) 回帖