hdu 2188 悼念512汶川大地震遇难同胞——选拔志愿者(Bash Game)

题意:从0开始捐款,每次不超过m元,首先达到n元的获胜

思路:等同于从n开始,每次取不超过m,首先达到0的获胜。(Bash Game)

#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
    int c,n,m;
    scanf("%d",&c);
    while(c--){
        scanf("%d%d",&n,&m);
        if(n%(m+1)!=0)printf("Grass
");
        else printf("Rabbit
");
    }
    return 0;
}
View Code
原文地址:https://www.cnblogs.com/gongpixin/p/4734555.html