HDU1847Good Luck in CET-4 Everybody!递推求解必胜、必败点 附三种经典博弈

Problem Description
大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。这不,Kiki和Cici在每天晚上休息之前都要玩一会儿扑克牌以放松神经。
“升级”?“双扣”?“红五”?还是“斗地主”?
当然都不是!那多俗啊~
作为计算机学院的学生,Kiki和Cici打牌的时候可没忘记专业,她们打牌的规则是这样的:
1、  总共n张牌;
2、  双方轮流抓牌;
3、  每人每次抓牌的个数只能是2的幂次(即:1,2,4,8,16…)
4、  抓完牌,胜负结果也出来了:最后抓完牌的人为胜者;
假设Kiki和Cici都是足够聪明(其实不用假设,哪有不聪明的学生~),并且每次都是Kiki先抓牌,请问谁能赢呢?
当然,打牌无论谁赢都问题不大,重要的是马上到来的CET-4能有好的状态。

Good luck in CET-4 everybody!
 

Input
输入数据包含多个测试用例,每个测试用例占一行,包含一个整数n(1<=n<=1000)。
 

Output
如果Kiki能赢的话,请输出“Kiki”,否则请输出“Cici”,每个实例的输出占一行。
 

Sample Input
   
   
   
   
1 3
 

Sample Output
   
   
   
   
Kiki Cici
 


破格式真是烦死我了还得重新写一遍

临阵磨枪 把学了的 忘了的 捡一捡~ 

博弈关键是求必胜点和必败点 每个必胜点都由必败点转化而来

#include <iostream>

using namespace std;
int a[10]={1,2,4,8,16,32,64,128,256,512};
int main()
{
    int f[1005]={0},i,j,n;
    for(i=0;i<1001;i++)
    {
        if(!f[i])
        for(j=0;j<10&&i+a[j]<1001;j++)
        f[i+a[j]]=1;
    }
    while(cin>>n)
    {
        if(f[n])
        cout<<"Kiki"<<endl;
        else
        cout<<"Cici"<<endl;
    }
    return 0;
}
一.巴什博弈(Bash Game):


首先我们来玩一个比较古老的报数游戏。A和B一起报数,每个人每次最少报一个,最多报4个。轮流报数,看谁先报到30.
如果不知道巴什博弈的可能会觉得这个是个有运气成分的问题,但是如果知道的人一定知道怎样一定可以赢。


比如A先报数的话,那么B一定可以赢(这里假定B知道怎么正确的报数)


B可以这样报数,每次报5-k(A)个数,其中k(A)是A报数的个数.
这样的话每一次两人报完数之后会变成5 10 15 20 25 30,这样是不是B一定会赢呢?是不是有一种被欺骗的感觉呢?
二.威佐夫博弈(Wythoff Game):


这种博弈比前面一种要稍微复杂一点。我们来看下下面这个游戏。


有两堆火柴棍,每次可以从某一堆取至少1根火柴棍(无上限),或者从两堆取相同的火柴棍数,最后取完的是胜利者。




直接记结论吧,证明自己上网查询。


若两堆火柴的初始值为(X,Y)    且X<Y,则令Z = Y - X,计算:


二.威佐夫博弈(Wythoff Game):


这种博弈比前面一种要稍微复杂一点。我们来看下下面这个游戏。


有两堆火柴棍,每次可以从某一堆取至少1根火柴棍(无上限),或者从两堆取相同的火柴棍数,最后取完的是胜利者。




直接记结论吧,证明自己上网查询。


若两堆火柴的初始值为(X,Y)    且X<Y,则令Z = Y - X,计算:












若W = X,则先手必败,否则先手必胜。








<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARIAAABUCAYAAABOQbjmAAAgAElEQVR4Ae2dZ3Bcx7WgvwkYDDAAZgY55xxIMOcsUsEUJdqyZVmWLdtyeuvdt/veVm29qt0q7+/dqn27+9bPz0FykiXZshIlKpCiGMQcQYIEEQiAyDnPYIDBzGz1nbkzdxIAikEUNZcFTt/u06dPn+577unTp89VuVwuF5ErwoH7lAPy9FSpVPcphRGyBAfUETZEOLAYDsgP9GJgbxdGtCW3JwsQ+f52cUfq3x0ORATJ3eFrBOsd4EBEeNwBJt4jFNp71E6kmQgHFs2BQC1Evl80ggjgPeeAKmIjuec8jzQY4cADx4HI0uaBG9J73yGlTePetx5p8X7gQESQ3A+jEKEhwoEvOAciNpIv+ADeD+TLNgyn08n09DSTk5PMzMzcMmlqtRq9Xo/RaESn091y/UiFz48DEUHy+fH+gWt5fHycv/3tb7z77rv09PTccv9iY2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3j5GXQlsfPhxdq6rQXzEMXLdnxyICJL7c1y+XFQJZUJcHnkya53gzJFDHDpZz5odu9nz1F5MHiESAOqpqKisyIkk7x0HFtqzvHeURFr68nJAJb6m6O6+iLdy6dg7nL14EXPNVnY9tIOqLF8ISwEWrL98eVl3v/Q8opHcLyPxpabDIxpmLLTXn+bjE1ewxOWz58nHqSnNDRMDP7xuIlip3A7+UrP2HnU+IkjuEaMjzczHARXMWWm7XsehY2eYTShi08atbKwOEfLA5ZQ+V6LTaR6AGDnz8eSLVRYRJF+s8XpAqXXRefUsHx8+ybUxPTt3rmHrsiK/vjrtNqbGBhmbBnWsmTRzLOowke1EReV2sB+iyM1d4UBEkNwVtkaQLp4Dc3RcO8ufXn1b+l7Lis3bMOmddNy4Ln0iVlhEdFoX3TdbOX78NGmly3nkyb1ovGcd5G3fiPVk8Ty/85ARQXLneRrBuEgOTI8PUn/+OK/86Q+89t5JrBiw2ca4fHw/Fov7cJ44Ci++KdTb20dLv43v/rAIkyFKipruayZifvXx4vNJRQTJ58P3SKvAaH8nJw8f5OPjl5gVH4NXTXLqxHH3JxbkEOkeTqm0seQs20p1dRVGv1kbESL3w2TyG5L7gaAIDQ8iB0IvP+xoySis4JnvpOFQadGoXNjnHN4dF5kT4iPn0bHx5JbXsnppmZwd+b2POKByyftk9xFREVIeNA7IW7WiXz4NYnx8lMnxMdTaKFRqraLEv/8upxNNVBQxsXHExOjRhoi4718jcnevORARJPea45H2Ihx4ADkQ8Wx9AAc10qUIB+41ByKC5F5zPNJehAMPIAf+Pwwu3uU6HVlsAAAAAElFTkSuQmCC" alt="" />






若W = X,则先手必败,否则先手必胜。
三.尼姆博弈(Nim Game):
 
指的是这样的一个博弈游戏,目前有任意堆石子,每堆石子个数也是任意的,双方轮流从中取出石子,规则如下:


1)每一步应取走至少一枚石子;每一步只能从某一堆中取走部分或全部石子;


2)如果谁取到最后一枚石子就胜。


这个问题,也直接记住结论吧。


把每堆石子数全部异或起来,如果得到的值为0 , 那么先手必败  否则先手必胜。





你可能感兴趣的:(算法,HDU,博弈)