HDU 1849 Rabbit and Grass

http://acm.hdu.edu.cn/showproblem.php?pid=1849

Nim博弈

View Code
#include <iostream>
using namespace std ;
int main()
{
    int n ;
    while(scanf("%d",&n),n)
    {
        int a ;
        int ans=0 ;
        while(n--)
        {
            scanf("%d",&a) ;
            ans^=a ;
        }
        if(!ans)
            puts("Grass Win!") ;
        else
            puts("Rabbit Win!") ;
    }
    return 0 ;
}
原文地址:https://www.cnblogs.com/xiaohongmao/p/2610011.html