View Code of Problem 197

#include <stdio.h>
#include <string.h>
//威佐夫博弈
int main() {
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF) {
		if (a > b) {
			int temp = a;
			a = b;
			b = temp;
		}
		if (floor((b - a)*(sqrt(5) + 1) / 2) == a) {
			printf("0\n");
		}
		else {
			printf("1\n");
		}
	}
}

Double click to view unformatted code.


Back to problem 197