打表找规律失败,搜了一下原来是wythoff博弈
/*--------------------------------------------------------------------------------------*/ #include <algorithm>
#include <iostream>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map> //debug function for a N*M array
#define debug_map(N,M,G) printf("\n");for(int i=0;i<(N);i++)\
{for(int j=;j<(M);j++){\
printf("%d",G[i][j]);}printf("\n");}
//debug function for int,float,double,etc.
#define debug_var(X) cout<<#X"="<<X<<endl;
#define LL long long
const int INF = 0x3f3f3f3f;
const LL LLINF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-;
/*--------------------------------------------------------------------------------------*/
using namespace std; int N,M,T;
int mem[][] = {};
const double q = (+sqrt(5.0)) / 2.0; void display(int x)
{
if(x==) return ;
display(x>>);
putchar((x&) + '');
} int sg(int a,int b)
{
if(mem[a][b] != -) return mem[a][b];
if(a == && b == )return ;
set<int> st ;
for(int i=;i<=a;i++)
{
st.insert(sg(a-i,b));
}
for(int i=;i<=b;i++)
{
st.insert(sg(a,b-i));
}
for(int i=;i<=min(a,b);i++)
{
st.insert(sg(a-i,b-i));
}
int g = ;
while(st.find(g) != st.end()) g++;
return mem[a][b] = g;
} int Wythoff(int a,int b)
{
if( a > b) swap(a,b);
int k = b - a;
if(a == (int)(k*q)) return ;
else return ;
} int main()
{
int a,b;
while(~scanf("%d%d",&a,&b))
{
printf("%d\n",Wythoff(a,b));
}
}