poj 1076 (博弈)

//poj 1067

/*

这是相对比较容易找到必败状态

先手取法:1、可以在任意的一堆中取走任意多的石子

2、可以在两堆中同时取走相同数量的石子

容易找到必败状态(1,2)(3, 5)(4, 7)(6,10)。。。

第几个必败状态 1=2-1 2=5-3 3=7-4 4=10-6.......

然而实现取有点难

可以存在这一个公式:具体看代码

*/

#include

#include

#include

using namespace std;

const double N=(1.0+sqrt(5.0))/2.0;

int main()

{

int a,b;

while(scanf("%d%d",&a,&b)==2)

{

int c=a

int d=a>b?a-b:b-a;//求第几个必败状态

if(c==(int)(d*N))

cout<<"0"<

else

cout<<"1"<

}

return 0;

}


推荐几款用于线上课程的好用屏幕标注工具
韵达外省快递几天到货(韵达加急跨省要多久?)