原题:https://www.luogu.org/problemnew/show/P1563
题目大意:有N个人围成一个圈,给定一串未化简的物品移动关系,要求你通过这些未化简的关系以及起始段的编号,求出物品最终位置的人的职业。
一个简单模拟题,随便写即可过。
PS:貌似是很久以前写的代码了,风格有些变化(不要吐槽~)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<stack>
#include<string.h>
#include<math.h>
#include<queue>
#define INF 2147483647
#define F(i,n) for(int i=0;i<n;i++)
#define F1(i,n) for(int i=1;i<=n;i++)
#define W while
#define S scanf
#define P printf
#define DD "%d%d"
#define DDD "%d%d%d"
#define DDDD "%d%d%d%d"
#define D "%d"
#define I int
#define V void
#define C char
#define R return
#define MS(i,a) memset(i,a,sizeof(i))
#define LL long long
#define SS string
#define DB double
#define PR priority_queue
#define ST struct
#define FBO friend bool operator
#define LDB long double
#define PI 3.14159265358979323846264
#define FI(x) freopen(x,"r",stdin);
#define FO(x) freopen(x,"w",stdout);
#define M 300000
using namespace std; bool b[M]={};
//string s[M]={0};
char s[M][]={};
int n,m; int main()
{
S(DD,&n,&m);
F1(i,n)
{
int x;
S(D,&x);b[i]=x;
S("%s",&s[i]);
}
int now=;
F1(i,m)
{
int x,y;
S(DD,&x,&y);
if(b[now]&&x) y=-y;
if(b[now]==&&x==) y=-y;
now=+(n+now+y-)%n;
}
P("%s",s[now]);
}