Description
Input
Output
Sample Input
2 1 8 4 4 7
Sample Output
0 1 0
这是个裸地威佐夫博奕,证明什么的原谅弱实在是看不懂,先证明了八个定理,然后根据这定理推出了这个公式,有兴趣的巨巨可以去百度百科去看,orz。
在这说一下威佐夫博奕的结论:两个人如果都采用正确操作,那么面对非奇异局势,先拿者必胜;反之,则后拿者取胜。
详情请在这里看---------->acm博弈论汇总
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
int main()
{
int a,b,k,tmp;
while(~scanf("%d %d",&a,&b)){
if(a>b) swap(a,b);
k=b-a;
tmp=(int)k*(1.0+sqrt(5.0))/2;
if(tmp==a)
printf("0\n");
else
printf("1\n");
}
return 0;
}
原文:http://blog.csdn.net/u013486414/article/details/44264171