标签:https return double 关系 day clu bool lan div
原题:https://www.luogu.org/problemnew/show/P1563
题目大意:有N个人围成一个圈,给定一串未化简的物品移动关系,要求你通过这些未化简的关系以及起始段的编号,求出物品最终位置的人的职业。
一个简单模拟题,随便写即可过。
PS:貌似是很久以前写的代码了,风格有些变化(不要吐槽~)
1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<map> 5 #include<stack> 6 #include<string.h> 7 #include<math.h> 8 #include<queue> 9 #define INF 2147483647 10 #define F(i,n) for(int i=0;i<n;i++) 11 #define F1(i,n) for(int i=1;i<=n;i++) 12 #define W while 13 #define S scanf 14 #define P printf 15 #define DD "%d%d" 16 #define DDD "%d%d%d" 17 #define DDDD "%d%d%d%d" 18 #define D "%d" 19 #define I int 20 #define V void 21 #define C char 22 #define R return 23 #define MS(i,a) memset(i,a,sizeof(i)) 24 #define LL long long 25 #define SS string 26 #define DB double 27 #define PR priority_queue 28 #define ST struct 29 #define FBO friend bool operator 30 #define LDB long double 31 #define PI 3.14159265358979323846264 32 #define FI(x) freopen(x,"r",stdin); 33 #define FO(x) freopen(x,"w",stdout); 34 #define M 300000 35 using namespace std; 36 37 bool b[M]={0}; 38 //string s[M]={0}; 39 char s[M][11]={0}; 40 int n,m; 41 42 int main() 43 { 44 S(DD,&n,&m); 45 F1(i,n) 46 { 47 int x; 48 S(D,&x);b[i]=x; 49 S("%s",&s[i]); 50 } 51 int now=1; 52 F1(i,m) 53 { 54 int x,y; 55 S(DD,&x,&y); 56 if(b[now]&&x) y=-y; 57 if(b[now]==0&&x==0) y=-y; 58 now=1+(n+now+y-1)%n; 59 } 60 P("%s",s[now]); 61 }
标签:https return double 关系 day clu bool lan div
原文地址:http://www.cnblogs.com/xiefengze1/p/7719531.html