这题为什么一直不对啊?求dalao帮忙。
代码:
#include <iostream>
#include<string>
using namespace std;
int n, m, t1, t2, num = 1;
struct per
{
int f;
string s;
}a[100001];
int main()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i].f >> a[i].s;
for (int i = 1; i <= m; i++)
{
cin >> t1 >> t2;
if ((t1 == 0 && a[num].f == 0) || (t1 == 1 && a[num].f == 1))
num = (num + m - t2) % m;
else
num = (num + t2) % m;
}
cout << a[num].s;
return 0;
}