Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 4533   Accepted: 2780

Description

Alice and Bob decide to play a funny game. At the beginning of the game they pick n(1 <= n <= 106) coins in a circle, as Figure 1 shows. A move consists in removing one or two adjacent coins, leaving all other coins untouched. At least one coin must be removed. Players alternate moves with Alice starting. The player that removes the last coin wins. (The last player to move wins. If you can't move, you lose.) 
 
Figure 1
Note: For n > 3, we use c1, c2, ..., cn to denote the coins clockwise and if Alice remove c2, then c1 and c3 are NOT adjacent! (Because there is an empty place between c1 and c3.)

Suppose that both Alice and Bob do their best in the game. 
You are to write a program to determine who will finally win the game.

Input

There are several test cases. Each test case has only one line, which contains a positive integer n (1 <= n <= 106). There are no blank lines between cases. A line with a single 0 terminates the input. 

Output

For each test case, if Alice win the game,output "Alice", otherwise output "Bob". 

Sample Input

1
2
3
0

Sample Output

Alice
Alice
Bob

Source

POJ Contest,Author:Mathematica@ZSU

THINKING

  博弈论问题,如果n<=2那么先手的会获得胜利,当n>=3时,先手的走了一步以后,后手的可以把这个一个大图分成两个完全相同的小图,每步都是如此,则在n步以后,先手的总会无棋可取,后手的获得胜利。

var t,n,i:longint;
begin
while true do
begin
readln(n);
if n= then halt;
if n<= then writeln('Alice')
else writeln('Bob');
end;
end.

[POJ2484]A Funny Game的更多相关文章

  1. POJ2484 A Funny Game[博弈论]

    A Funny Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5401   Accepted: 3381 Desc ...

  2. [poj2484]A Funny Game(对称博弈)

    题目:http://poj.org/problem?id=2484 题意:n个石子围成一个圈,两个人轮流取,每次可以取一个石子或者相邻的两个石子,问先手胜还是后手胜 分析: 典型的对称博弈 如果n&g ...

  3. POJ2484

    A Funny Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6178   Accepted: 3861 Desc ...

  4. 【博弈论】poj2484 A Funny Game

    如果当前状态可以根据某条轴线把硬币分成两个相同的组,则当前状态是必败态. 因为不论在其中一组我们采取任何策略,对方都可以采取相同的策略,如此循环,对方必然抽走最后一枚硬币. 因为我们先手,因此抽完后盘 ...

  5. 【POJ】1067 取石子游戏(博弈论)

    Description 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相同数量的石子.最后 ...

  6. 博弈论BOSS

    基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530 经典翻硬币游戏小结:http://blog.csdn.net/acm_c ...

  7. 【Mark】博弈类题目小结(HDU,POJ,ZOJ)

    转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 首先当然要献上一些非常好的学习资料: 基础博弈的小 ...

随机推荐

  1. Linux和Windows下查看环境变量方法对比

    摘自:Linux和Windows下查看环境变量方法对比 一.查看所有环境变量的名称和值 Linux下:export Windows下:set 二.根据名称查该环境变量的值 Linux下:echo $环 ...

  2. 一步步学习ASP.NET MVC3 (15)——过滤器

    请注明转载地址:http://www.cnblogs.com/arhat 今天老魏和大家一起讨论一下ASP.NET MVC中非常重要的一个知识:"过滤器".那么这个"过滤 ...

  3. 一步步学习NHibernate(1)——NHibernate介绍

    请注明转载地址:http://www.cnblogs.com/arhat 第十五章 从本章开始,老魏将给大家一起学习NHibernate这个流行的ORM框架,本来老魏想要和大家一起探讨微软的EF框架的 ...

  4. 图片上传并显示(兼容ie),图片大小判断

    图片上传并显示(兼容ie),图片大小判断 HTML <div id="swf" style="margin: 0 auto;text-align: center;& ...

  5. 74HC595

    74HC595 输入:串行输入 输出:并行/串行输出 用74HC595做一个流水灯 电路图 程序 /*====================== 测试74HC595 ================ ...

  6. <六> jQuery 获得内容和属性

    获得内容 三个简单实用的用于 DOM 操作的 jQuery 方法: text() - 设置或返回所选元素的文本内容 html() - 设置或返回所选元素的内容(包括 HTML 标记) val() - ...

  7. python 文件查找 glob

    glob模块是最简单的模块之一,内容非常少.用它可以查找符合特定规则的文件路径名.跟使用windows下的文件搜索差不多.查找文件只用到三个匹配符:"*", "?&quo ...

  8. var a=[]; 和 var a=new Array(); 的区别,为什么前者效率高

    因为 JSON格式的语法是引擎直接解释的.而new Array 则需要调用Array的构造器.还有就是1.当你需要将一个数字转化为字符串时可以这样定义:var s=""+1; 这样 ...

  9. 从一个脚本谈loadrunner的脚本初始化

    昨天一个同事问我,如何实现下列代码中 InputStream类is对象的实例化? * LoadRunner Java script. (Build: _build_number_) * * Scrip ...

  10. 服务器部署_centos 安装jdk手记

    1. 下载jdk略. 2. 将jdk相关文件目录放到指定目录 (1) 创建jdk目录 /usr/java/jdk7 mkdir -p /usr/java/jdk7 (2) 解压缩jdk压缩包,并移动至 ...