Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4024 Accepted Submission(s): 3040
1 #include<stdio.h> 2 int main() 3 { 4 int ans,n,a; 5 while(scanf("%d",&n),n) 6 { 7 ans=0;//因为一个数和0的异或等于本身,所以可以赋初值为0 8 while(n--) 9 { 10 scanf("%d",&a); 11 ans=ans^a; 12 } 13 if(ans==0) printf("Grass Win!\n"); 14 else printf("Rabbit Win!\n"); 15 } 16 return 0; 17 }
hdu 1849 Rabbit and Grass(nim)
原文:http://www.cnblogs.com/bofengyu/p/6783330.html