luogu P2252 [SHOI2002]取石子游戏|【模板】威佐夫博弈
不会证明,记一波结论
\(n<m\)
当\((m-n)*\frac{1+\sqrt{5}}{2}==n\)的时候后手必胜
否则先手必胜
code:
#include<bits/stdc++.h>
using namespace std;
const double K = (1.0 + sqrt(5.0)) / 2.0;
int n, m;
int main() {
scanf("%d%d", &n, &m); if(n > m) swap(n, m);
if(n == (int)((m - n) * 1.0 * K)) printf("0"); else printf("1");
return 0;
}