Tribute to the 512 Wenchuan earthquake--selection of volunteers
Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 6982 Accepted Submission (s): 4421
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 INPUT28 1011 10
Sample Outputgrassrabbit
Authorlcy is one of the simplest game theory topics. See Bashbor game
1 /*************************************************************************2 > File name:code/hdu/2188.cpp3 > Author:111qqz4 > Email: [Email protected]5 > Created time:2015 September 22 Tuesday 20:08 08 seconds6 ************************************************************************/7 8#include <iostream>9#include <iomanip>Ten#include <cstdio> One#include <algorithm> A#include <cmath> -#include <cstring> -#include <string> the#include <map> -#include <Set> -#include <queue> -#include <vector> +#include <stack> -#include <cctype> + #defineY1 HUST111QQZ A #defineYn hez111qqz at #defineJ1 CUTE111QQZ - #defineMS (A,X) memset (A,x,sizeof (a)) - #defineLR DYING111QQZ - using namespacestd; - #definefor (i, n) for (int i=0;i<int (n); ++i) -typedefLong LongLL; intypedefDoubleDB; - Const intINF =0x3f3f3f3f; to voidSolve () + { - intn,m; thescanf"%d%d",&n,&m); * if(n% (m+1)!=0) $ {Panax NotoginsengPuts"Grass"); - } the Else + { APuts"Rabbit"); the } + } - intMain () $ { $ #ifndef Online_judge -Freopen ("In.txt","R", stdin); - #endif the intT; -Cin>>T;Wuyi while(t--) the { - solve (); Wu } - #ifndef Online_judge About fclose (stdin); $ #endif - return 0; -}
View Code
HDU 2188 Tribute to 512 Wenchuan earthquake victims--selection of volunteers (game theory, Bashbor)