求助 95
查看原帖
求助 95
355559
FutureThx楼主2020/6/30 12:58

测试点#8WA,找不出问题,求大佬指点!

#include <iostream>
using namespace std;
struct People
{
    char name[12];
    bool right_or_left;
}Little_Peolpe[1000001];
int main()
{
    long long n,m,a,s,suspect_number = 1;
    cin >> n >> m;
    for(long long i = 1;i <= n;i++)
       cin >> Little_Peolpe[i].right_or_left >> Little_Peolpe[i].name;
    for(long long i = 1;i <= m;i++)
    {
        cin >> a >> s;
        if(a == Little_Peolpe[suspect_number].right_or_left)
        {
            if(suspect_number - s <= 0)
                suspect_number = n + (suspect_number - s);
            else
                suspect_number = suspect_number - s;
        }
        else
          suspect_number = (suspect_number + s) % n;
    }
    cout << Little_Peolpe[suspect_number].name;
    return 0;
}
2020/6/30 12:58
加载中...