POJ 1067 取石子游戏
解説
ゲームにっき(仮) |PKU 1067 - 取石子游戏ここを見て解きました...。もう答えのようなものなので無念。
#include <iostream> #include <cmath> #include <algorithm> using namespace std; int main(){ int a,b; double r = (1+sqrt(5.0))/2; while(cin>>a>>b){ if(a>b) swap(a,b); if(floor((b-a)*r)==a) puts("0"); else puts("1"); } }