Description
選拔規則如下:
1、最初的捐款箱是空的;
2、兩人輪流捐款,每次捐款額必須爲正整數,並且每人每次捐款最多不超過m元(1<=m<=10)。
3、最先使得總捐款額達到或者超過n元(0<n<10000)的一方爲勝者,則其可以親赴災區服務。
我們知道,兩人都很想入選志願者名單,並且都是非常聰明的人,假設林隊先捐,請你判斷誰能入選最後的名單?
Input
Output
Sample Input
Sample Output
解題思路:
巴什博弈模板題。
AC代碼:
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int c, n, m;
scanf("%d", &c);
while(c--)
{
scanf("%d%d", &n, &m);
if(n % (m + 1))
printf("Grass\n");
else
printf("Rabbit\n");
}
return 0;
}