标签:
POJ 1067
Description
Input
Output
Sample Input
2 1 8 4 4 7
Sample Output
0 1 0
思路:参照http://www.cnblogs.com/jiangjun/archive/2012/10/25/2740194.html
判断必败点:(m(k),n(k))
m(k) = k * (1 + sqrt(5))/2
n(k) = m(k) + k;
#include <stdio.h> #include <math.h> int main() { int a,b,d; while(~scanf("%d%d",&a,&b)) { if(a < b)//a,b交换 { a ^= b; b ^= a; a ^= b; } d = a - b; a = (int)(d*(1+sqrt(5))/2); if(a == b) puts("0"); else puts("1"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/520xiuge/p/5186753.html