HDU 2188 Tribute to 512 Wenchuan earthquake victims--selection of volunteers (Bashbor)

Source: Internet
Author: User

Tribute to the 512 Wenchuan earthquake--selection of volunteersTime limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 7950 Accepted Submission (s): 5024


Problem description for Sichuan compatriots suffering from the disaster, the people have reached a helping hand, almost every provinces and cities have sent a large number of rescue workers, including emergency relief of the armed police force, treatment and prevention of medical personnel, as well as psychological counseling psychology experts. According to the requirements, our school also has a disaster relief in the area, because the vast number of teachers and students enrolled enthusiastically, the school had to conduct a selection to determine the final candidate. After several rounds of examination, the situation is gradually clear, the final quota will be in the "Lin" and "Xu team" between the production. But coincidentally, 2 people's resume almost identical, this makes the host selection of 8600 is very embarrassed. Helpless, he decided to donate money to decide who can be selected.
The selection rules are as follows:
1, the original donation box is empty;
2. The two persons make a round contribution, each of which must be a positive integer, and each donation is not more than M (1<=m<=10) per person.
3, the first to make total contributions to reach or exceed N yuan (0<n<10000) of the party as the winner, it can be pro-disaster services.
We know that both of us want to be on the volunteer list, and are very smart people, assuming the forest team first donate, please judge who can be selected in the final list?

Input data first contains a positive integer c, which represents the C set of test cases, followed by the C row of data, each row contains two positive integers n,m,n and m meaning see the rules mentioned above.
Output for each set of test data, if the forest can be selected, export the string "Grass", if Xu can be selected, output the string "Rabbit", the output of each instance is one row.
Sample Input
28 1011 10

Sample Output
Grassrabbit

Authorlcy
SOURCE2008-06-18 "ACM Program Design" Final Exam--Sichuan refueling! China Refueling!
original title link: http://acm.hdu.edu.cn/discuss/problem/list.php?problemid=2188
Standard Bashbor, do not explain!
AC Code:
#include <iostream>using namespace Std;int main () {    int t;    cin>>t;    while (t--)    {        int n,m;        cin>>n>>m;        if (n% (m+1))            cout<< "Grass" <<endl;        else             cout<< "Rabbit" <<endl;    }    return 0;}



HDU 2188 Tribute to 512 Wenchuan earthquake victims--selection of volunteers (Bashbor)

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.