对战中一次只能取1 3 7 8球 取到最后 没有球取的输 

 

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

//局面:n 所剩球的数目 
int f(int n)
{
    if(n>=8 && f(n-8)==0) return 1; 
    if(n>=7 && f(n-7)==0) return 1; 
    if(n>=3 && f(n-3)==0) return 1;
    if(n>=1 && f(n-1)==0) return 1; 
}


int main()
{
    cout << f(4);    

    return 0;
}
实现代码

 

内容来源于网络如有侵权请私信删除
你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!

相关课程

4101 9.8元 100元 0.98折
3607 0元 45元 限免