# include <algorithm> # include <stdio.h> # include <string.h> # include <math.h> # include <iostream> using namespace std; int main() { int n,m,i,a,b,cot; while(~scanf("%d%d",&n,&m)) { cot=0; for(i=0; i<n; i++) { scanf("%d%d",&a,&b); cot^=abs(abs(a-b)-1); // 把中间差的空格,即走的总步数,当作总石头数, } if(cot==0)//平衡状态,后手赢 printf("BAD LUCK!\n"); else printf("I WIN!\n"); } return 0; }
hdu 1730 Northcott Game (nim博弈变形)
原文地址:http://blog.csdn.net/lp_opai/article/details/39297389