C.报数游戏
题解
巴什博弈题,奇异状态(必胜态)为5的倍数的数;
最优策略为:
n=(4+1)*r+s;先手报s个数,之后每次报(4+1-k)个数,k为对手报的数
CODE
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n;
cin>>n;
if(n%5==0)
{
cout<<"-1"<<endl;
}
else
{
cout<<n%5<<endl;
}
return 0;
} 
京公网安备 11010502036488号