Sicily 1798. Alice and Bob

判断n*n是否为偶数就行。简单的证明可以用1*2的骨牌布满棋盘。对方每走一步,你走1*2骨牌剩下的另一格,能保证必胜。

/* source code of submission 312719, Zhongshan University Online Judge System */ #include using namespace std; int main() { int n; while ( scanf("%d", &n) && n!=0 ) { if ( (n*n)%2==0 ) printf("Alice/n"); else printf("Bob/n"); } return 0; }

 

你可能感兴趣的:(ACM题解)