hdu 1730 Northcott Game 博弈论

很简单的博弈论问题,可以转化为Nim

代码如下:

 1 #include<iostream>
 2 #include<stdio.h>
 3 #include<algorithm>
 4 #include<iomanip>
 5 #include<cmath>
 6 #include<cstring>
 7 #include<vector>
 8 #define ll __int64
 9 #define pi acos(-1.0)
10 #define MAX 50000
11 using namespace std;
12 int n,m,t,j,ans;
13 int main(){
14     while(scanf("%d%d",&n,&m)!=EOF){
15         ans=0;
16         for(int i=0;i<n;i++){
17             scanf("%d%d",&t,&j);
18             ans^=abs(t-j)-1;
19         }
20         puts(ans==0?"BAD LUCK!":"I WIN!");
21     }
22     return 0;
23 }
View Code
原文地址:https://www.cnblogs.com/xin-hua/p/3251351.html