Mourning for the victims of the 512 Wenchuan earthquake-selecting volunteers
Time Limit: 1000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 1858 accepted submission (s): 1050
Problem description: people throughout the country have extended a helping hand to help Sichuan compatriots suffer from disasters. Almost every province and city has sent a large number of rescue personnel, including the rescue and relief armed police forces, medical staff for treatment and epidemic prevention, and psychology experts for psychological counseling. According to the requirements, our school also has a number of places to go to the disaster recovery area, because the majority of students and students register enthusiastically, the school had to select to decide the final candidates. After multiple rounds of assessment, the situation is gradually clear, and the final quota will be generated between "Lin" and "Xu. However, coincidentally, the resumes of the two people are almost identical, which makes the selection of the host 8600 very difficult. However, he decided to decide who can be selected by donating money.
The selection rules are as follows:
1. The original donation box is empty;
2. The donation amount must be a positive integer, and each donation cannot exceed m RMB (1 <= m <= 10 ).
3. If one party who makes the total donation amount reach or exceed N yuan (0 <n <10000) is the winner, the party can provide services in the affected area.
We know that both of them really want to be included in the volunteer list, and they are both very smart people. If the Forest Team donate, Please judge who can be included in the final list?
Input data first contains a positive integer c, which indicates that the test cases in group C are included, followed by data in Row C. Each row contains two positive integers n, m, for the meaning of N and M, see the rules mentioned above.
Output for each group of test data, if the forest team can be selected, please output the string "Grass". If the Xu team can be selected, please output the string "rabbit", each instance outputs a line.
Sample input2
8 10
11 10
Sample outputgrass
Rabbit
Authorlcy
Source2008-06-18 "ACM Program Design" Final Examination -- Sichuan come on! China!
Recommendlcy detailed explanation to see Bashi game: http://www.cnblogs.com/kuangbin/archive/2011/08/28/2156426.html
# Include < Stdio. h >
Int Main ()
{
Int N, m;
Int T;
Scanf ( " % D " , & T );
While (T -- )
{
Scanf ( " % D " , & N, & M );
If (N % (M + 1 ) = 0 ) Printf ( " Rabbit \ n " );
Else Printf ( " Grass \ n " );
}
Return 0 ;
}