80分求助
查看原帖
80分求助
871868
songshihao666888楼主2023/2/7 15:11
#include<iostream>
using namespace std;
struct mem 
{
    int tow;//0表示圈内1表示圈外
    string mem;
};
struct point
{
    int fx;//0表示向左1表示向右
    int cishu;
};
int main()
{
    int n, z;
    cin >> n >> z;
    mem stu[200000];
    for (int i = n; i>=1; i--)
    {
        cin >> stu[i].tow >> stu[i].mem;
    }
    point po[200000];
    for (int i = 1; i <= z; i++)
    {
        cin >> po[i].fx >> po[i].cishu;
    }
    int lo=n;
    for (int i = 1; i <= z; i++)
    {
        if (po[i].fx == 0&&stu[lo].tow==1|| po[i].fx == 1 && stu[lo].tow == 0)
        {
            while (po[i].cishu >= 1)
            {
                if (lo == 1)
                {
                    lo = n; po[i].cishu--;
                }
                else
                {
                    lo--;
                    po[i].cishu--;
                }
            }
        }
        if (po[i].fx == 0 && stu[lo].tow == 0|| po[i].fx == 1 && stu[lo].tow == 1)
        {
            while (po[i].cishu >= 1)
            {
                if (lo == n)
                {
                    lo = 1; po[i].cishu--;
                }
                else
                {
                    lo++;
                    po[i].cishu--;
                }
            }
        }
    }
    cout << stu[lo].mem;
    return 0;
}
2023/2/7 15:11
加载中...