Test instructions: 1-n numbered box, when the number satisfies a>b && A non-null && (A + b)% 3 = = 0 && (A + B)% 2 = = 1 can be taken from A
The Italian stone to B, who can not take who will lose.
Alice Initiator
Ladder game: The game is carried on a ladder, each ladder is placed on a natural number of points, two people to carry out the ladder game, each step is to a group on a number of points
(>=1) move to the front, and finally there is no point to move the person to lose.
The state of 1,3,4 in the subject cannot be transferred to another State; Each of the other states can be transferred; and location-specific, such as 2->1, 5->4, 6->3, 7->2
, 8->1 9->6,10->5 11->4. 15->6.
11->4 12->3 14->1
17->4 19->3 20->1
...
Position i%6 = = 0 2 5 of these positions can be moved to 1 3 4 This is equivalent to the Nim game in these several positions
Sample Input
2
2
1 2
7
1 3 3 2 2 1 2
Sample Output
Case 1:alice
Case 2:bob
1# include <iostream>2# include <cstdio>3# include <cstring>4# include <algorithm>5# include <string>6# include <cmath>7# include <queue>8# include <list>9# define LLLong LongTen using namespacestd; One A intMain () - { - //freopen ("In.txt", "R", stdin); the intT; -scanf"%d", &T); - intCase =0 ; - while(t--) + { - intn, x; + inti; Acase++ ; atprintf"Case %d:", case); -scanf"%d", &n); - intAns =0 ; - for(i =1; I <= N; i++) - { -scanf"%d", &x); in if(i%6==0|| i%6==2|| i%6==5) -Ans ^=x; to } + if(ans = =0) -printf"bob\n") ; the Else *printf"alice\n") ; $ Panax Notoginseng } -}
View Code
HDU 3389 Ladder Game