View Code of Problem 197

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
//威佐夫博弈算法
int main()
{
	int a, b;
	while (cin >> a >> b) {
		double c = (sqrt(5.0) + 1) / 2;
		int temp = (int)abs(a - b)*c;
		int minnum = min(a, b);
		if (minnum ==temp) {
			cout << 0 << endl;
		}
		else {
			cout << 1 << endl;
		}
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 197