P3150 pb的游戏(1)

P3150 pb的游戏(1)
选偶数,这一轮一定会活,选奇数,自己这一轮可能会死,并且(如果自己这一轮没死)下一轮对手一定可以活,因为选了奇数,就会被分解成奇数和偶数。

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<queue>
 4 #include<algorithm>
 5 #include<cmath>
 6 #include<ctime>
 7 #include<cstring>
 8 #define inf 2147483647
 9 #define For(i,a,b) for(register int i=a;i<=b;i++)
10 #define p(a) putchar(a)
11 #define g() getchar()
12 
13 using namespace std;
14 int m,x;
15 void in(int &x)
16 {
17     int y=1;
18     char c=g();x=0;
19     while(c<'0'||c>'9')
20     {
21     if(c=='-')
22     y=-1;
23     c=g();
24     }
25     while(c<='9'&&c>='0')x=x*10+c-'0',c=g();
26     x*=y;
27 }
28 void o(int x)
29 {
30     if(x<0)
31     {
32         p('-');
33         x=-x;
34     }
35     if(x>9)o(x/10);
36     p(x%10+'0');
37 }
38 int main()
39 {
40     in(m);
41     For(i,1,m)
42     {
43         in(x);
44         if(x%2==1)
45         puts("zs wins");
46         else
47         puts("pb wins");
48     }
49      return 0;
50 }
原文地址:https://www.cnblogs.com/war1111/p/7786978.html