传送门

威佐夫博弈结论:若石子数为\(a,b(a<b)\),当且仅当\((y-x)*\frac{(\sqrt{5}+1)}{2}=x\)的时候先手必败
证明

//minamoto
#include<iostream>
#include<cmath>
using namespace std;
const double phi=(sqrt(5)+1)/2;
int main(){
	int a,b;
	while(cin>>a>>b){
		if(a>b)swap(a,b);
		int A=(b-a)*phi;
		cout<<(A==a?0:1)<<endl;
	}return 0;
}

相关文章:

  • 2021-10-02
  • 2021-10-11
  • 2021-07-03
  • 2021-09-03
  • 2021-08-28
猜你喜欢
  • 2021-12-04
  • 2022-12-23
  • 2021-08-23
  • 2021-07-30
  • 2021-06-04
相关资源
相似解决方案