求改
查看原帖
求改
857272
wjc20101030楼主2024/1/24 09:55
#include<bits/stdc++.h> 
using namespace std;
struct m{
	int fx;
	string name;
};
m ers[100010];
int main(){
	int n,m,x,y,z=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>ers[i].fx>>ers[i].name;
	}
	for(int i=1;i<=m;i++){
		cin>>x>>y;
		if((ers[z].fx==0&&x==0)||(ers[z].fx==1&&x==1)){
			z=z-y;
			if(z<=0){
				z=n+z;
			}
		}					
		if((ers[z].fx==1&&x==0)||(ers[z].fx==0&&x==1)){
			z=z+y;
			if(z>n){
				z=z-n;
			}
		}
	}
	cout<<ers[z].name;
	return 0;
}
2024/1/24 09:55
加载中...