Description
As we know, Alice is a lovely little girl in primary school, she has a childhood sweetheart Bob, they often playing game together.Now, they are playing a game with coins.
A row of N coins on the desk from left to right.The side of some coins are head(正面),others are tail(反面).Alice
and Bob play in turn, every time the player can only choose a coin with head side and reverse it to tail, at the mean
time ,all the coins that from the left side of the chosen one will also be reversed,head will change to tail ,and tail change to head.
The player who cannot choose an head coin lost the game.Suppose that both Alice and Bob do their best in the game and Alice always play first.You are to write a program to determine who will finally win the game.
Input
The Input contain T(1 <= T <= 10) test cases. For each test case, the first line is an integer N(1 <= N <= 100), then N coins in the next line,1 means head and 0 means tail.
Output
For each test cases, output the name of winner in a line.
Sample Input
2 2 0 1 5 1 0 0 1 0
Sample Output
Bob Alice 题目来自移动信息工程学院短码之美月赛02 题目大意是给出01序列代表硬币正反面,1为正,每个人只能选择一个1变为0,同时让这个1左边的所有0变成1,所有1变成0,Alice先开始,输出赢家。这道题通过找规律不难发现最后的1右边的0是没用的,并且当第一个硬币为正时,Alice无论怎么翻都能把状态变成000...111...这样的序列,意味着Bob必须会输。
|
Game
最新推荐文章于 2023-05-19 17:46:19 发布