取石子游戏 - 威佐夫博弈

题目链接:https://www.luogu.org/problemnew/show/P2252

 

应用结论即可,证明参考:https://www.cnblogs.com/zwfymqz/p/8469863.html#_label0

 1 #include<iostream>
 2 #include<cmath>
 3 using namespace std;
 4 
 5 int a, b;
 6 
 7 int main()
 8 {
 9     while(cin>>a>>b) {
10         int tmp = abs(a-b)*(sqrt(5.0)+1.0)/2.0;
11         if(tmp == min(a,b)) cout<<0<<endl;
12         else cout<<1<<endl;
13     }
14     return 0;
15 }

 

posted @ 2018-08-18 17:06  liubilan  阅读(79)  评论(0)    收藏  举报