题目描述 传送门
水题而已,没什么好说的。
就是看看能不能最快速度AC(我的代码能力好差的QWQ…)
代码
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
string name[100010];
int face[100010];
int main(){
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>face[i]>>name[i];
int now=0;
int i;
for(int i=0;i<m;i++){
int a,b;
scanf("%d%d",&a,&b);
if(a^face[now]){
now=(now+b)%n;
}
else{
now=now-b;
if(now<0) now+=n;
}
}
cout<<name[now]<<endl;
}