Total Submission (s): 1621 Accepted Submission (s): 1225
Problem Description university time is romantic, girls are romantic, and Christmas is even more romantic, but Rabbit and Grass are both not romantic at Christmas this year: they don't go to shopping malls, they don't go to movie parks, they don't go on dates with AC male, and two people are playing chess in the movie ......
Playing chess is actually a simple game. The rules of the game are as follows:
1. The checkerboard contains 1 * n squares, numbered 0, 1, 2,… from left to right ,..., N-1;
2. Place m pieces on the checker Square. The square can be empty or more than one piece;
3. The two sides take turns playing chess;
4. Each step can move any piece to any position on the left (multiple pieces can be placed in the same square). Of course, any piece cannot go beyond the boundaries of the Board;
5. If all the pawns are on the leftmost side (that is, the number is 0), the game ends, and the final player is the winner.
For this question, you do not need to consider the size of n (we can assume that in the initial state, the pawn is always in the proper position of the Board ). The following figure shows a 1*15 board with six pawns in total. The position 8 contains two pawns.
As you know, although occasionally not romantic, Rabbit and Grass are both ice and snow smart girls. If every time Rabbit goes first, please output the final result.
The Input data contains multiple groups of test cases. Each test case occupies two rows. The first row contains an integer m (0 <= m <= 1000), indicating the number of pieces in the test case, the following line contains m integers Ki (I = 1... M; 0 <= Ki <= 1000), indicating the initial position of m pieces, and m = 0 indicates the end of the input.
Output if Rabbit can Win, please Output "Rabbit Win !", Otherwise, output "Grass Win !", The output of each instance occupies one row.
Sample Input
2 3 533 5 60
Sample Output
Rabbit Win! Grass Win! Into a nim game!#include <iostream>#include <stdio.h>#include <string.h>using namespace std;int main(){ int n,i,ans,x; while(scanf("%d",&n)!=EOF&&n){ for(ans=0,i=0;i<n;i++){ scanf("%d",&x); ans^=x; } if(ans)printf("Rabbit Win!\n"); else printf("Grass Win!\n"); } return 0;}