HDU 2188 悼念512汶川大地震遇难同胞——选拔志愿者(巴什博弈)

思路:若能给对方留下m+1,就可以胜。否则败。

 1 #include <iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int t,n,m;cin>>t;
 6     while(t--)
 7     {
 8         cin>>n>>m;
 9         if(n%(m+1)==0)
10             cout<<"Rabbit"<<endl;
11         else
12             cout<<"Grass"<<endl;
13     }
14     return 0;
15 }
AC代码
原文地址:https://www.cnblogs.com/xcw0754/p/4496862.html