Nim游戏
#include <stdio.h> int main() { int m,n,a; while(scanf("%d", &m), m) { n = 0; while(m-- && scanf("%d", &a)) n ^= a; puts(n ? "Rabbit Win!" : "Grass Win!"); } return 0; }
时间: 2024-10-07 02:06:06
Nim游戏
#include <stdio.h> int main() { int m,n,a; while(scanf("%d", &m), m) { n = 0; while(m-- && scanf("%d", &a)) n ^= a; puts(n ? "Rabbit Win!" : "Grass Win!"); } return 0; }