Hdoj HDU 2188 mourns the victims of the 512 Wenchuan earthquake-selecting volunteers ACM 2188 in HDU

Source: Internet
Author: User
Miyu original, post Please note: Reprinted from __________ White House

Question address:
Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2188
Description:Mourning for the victims of the 512 Wenchuan earthquake-selecting volunteers

Time limit:1000/1000MS (Java/Others) memory limit:32768/32768K (Java/Others)
Total submission (s ):1337Accepted submission (s ):716

Problem description
In response to the disasters suffered by Sichuan compatriots, the people throughout the country have extended a helping hand. Almost every province and city has sent a large number of rescue personnel, including the armed police forces for disaster relief, 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 yuan ( 1 <= M <= 10 ).
3 First, make the total donation amount reach or exceed N yuan ( 0 < N < 10000 If either party is the winner, they can go to the disaster area to provide services.
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
The input data first contains a positive integer c, which indicates that the test case contains group C, followed by row C data. Each row contains two positive integers n, m, n, and M. For more information, 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 Xu can be selected, please output the string"Rabbit"The output of each instance occupies one row.
 

Sample Input
2
8 10
11 10
 

Sample output
Grass
Rabbit

Question Analysis: A very standard bash game. You only need to think of donations as money withdrawal. Whoever gets the money will win. For more information, please click the game introduction.


CodeAs follows:Miyu original, post Please note: Reprinted from__________ White House

# Include < Iostream >
Int Main ()
{
Int T;
Scanf ( " % D " , & T );
{
While (T -- )
{
Int N, m;
Scanf ( " % D " , & N, & M );
Puts (n % ( 1   + M) ! =   0   ?   " Grass " : " Rabbit " );
}
}
Return   0 ;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.