HDU1849 Rabbit and Grass()

用异或看取得的值是否为0推断

思想换没搞懂

#include<stdio.h>
int main()
{
    int ans,n,a;
    while(scanf("%d",&n),n){
        ans=0;
        while(n--){
            scanf("%d",&a);
            ans=ans^a;
        }
        if(ans==0) printf("Grass Win!\n");
        else printf("Rabbit Win!\n");
    }
    return 0;
}


你可能感兴趣的:(HDU1849 Rabbit and Grass())