90分求助
查看原帖
90分求助
844619
tmz2011楼主2023/3/20 20:21
#include <bits/stdc++.h>
using namespace std;
int n, m;
struct a {
	int head;
	string name;
}aa[100010];
int main () {
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		cin >> aa[i].head >> aa[i].name;
	int s = 1;
	for (int i = 1; i <= m; i++) {
		int x, y;
		cin >> x >> y;
		if (aa[s].head == 1) {
			if (x == 0)
				s=(s + y) % n;
			else	
				s=(s + n - y) % n;
		}
		else {
			if(x == 1)
				s=(s + y) % n;
			else	
				s=(s + n - y) % n;
		}
	}
	cout << aa[s].name;
	return 0;
}
2023/3/20 20:21
加载中...