Acwing 1318. 取石子游戏(博弈论)
https://www.acwing.com/problem/content/1320/
输入样例:
23 3
输出样例:
1
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
const LL MAXN=1e18,MINN=-MAXN,INF=0x3f3f3f3f;
const LL N=100200,M=2020;
int main()
{
cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
LL T=1;
//cin>>T;
while(T--)
{
LL n,k;
cin>>n>>k;
if(n%(k+1)!=0) cout<<1<<endl;
else cout<<2<<endl;
}
return 0;
}