威佐夫博弈

//威佐夫博弈(Wythoff Game):有两堆各若干个物品
//两个人轮流从某一堆或同时从两堆中取同样多的物品
//规定每次至少取一个,多者不限,最后取光者得胜。

#include<bits/stdc++.h>
using namespace std;
int T,n,x;
int a,b;
double num=(1+sqrt(5))/2;

int main(){
scanf("%d",&T);
while(T--){
bool flag;
scanf("%d%d",&n,&x);
a=n-x;
b=x-1;
if(a>b){
int tem=a;
a=b;
b=tem;
}
if(a==b){
if(a==0) flag=0;
else flag=1;
}
if(a<b){ //a<b
double k=(double)(b-a);
int test=(int)(k*num);
if(a==test) flag=0;
else flag=1;
}

if(flag==1) puts("yo xi no forever!"); //?
else puts("ma la se mi no.1!");
}
return 0;
}

posted @ 2021-03-28 13:17  starlightlmy  阅读(89)  评论(0)    收藏  举报