一:巴什博奕:
有一堆石子共有N个。A B两个人轮流拿,A先拿。每次最少拿1颗,最多拿K颗,拿到最后1颗石子的人获胜。假设A B都非常聪明,拿石子的过程中不会出现失误。给出N和K,问最后谁能赢得比赛。
结果:
if(n%(m+1)==0) cout<<"后手必胜"<<endl;
else cout<<"先手必胜"<<endl;
AC代码:
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int MAX = 1e6+10;
const int INF = 0x3fffffff;
int main()
{
int t;
cin>>t;
while(t--){
int n,k;
scanf("%d%d",&n,&k);
if(n%(k+1)==0){
printf("B\n");
}