原文链接https://vjudge.net/contest/331993#problem/H

Alice and Bob decide to play a funny game. At the beginning of the game they pick n(1 <= n <= 10 6) 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 <= 10
6). 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
#include <stdio.h>
int main() {
int n;
while(scanf("%d", &n)) {
if(n==) break;
if(n <= )
printf("Alice\n");
else
printf("Bob\n");
}
return ;
}
//1、2个先手赢,3个后手赢,
//现在分析n>=4的情况,先手操作后,环就变成了链,
//如果取走链的中间一个或者两个,变成两个相同的链,
//那么接下来对方怎么取,就再另一串链进行相同操作,这样就可以赢了。
//也就是说00 00、000 000、0000 0000、......这样的左右相同的情况都是先手必败的情况。
//所以一条链时是先手必赢,一个环(n>3)是先手必败的情况。

vjudge A Funny Game 思维题 (其实今天讲的全是数学。。。)的更多相关文章

  1. UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There Was One / POJ 3517 And Then There Was One / Aizu 1275 And Then There Was One (动态规划,思维题)

    UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There W ...

  2. HDU 1029 Ignatius and the Princess IV / HYSBZ(BZOJ) 2456 mode(思维题,~~排序?~~)

    HDU 1029 Ignatius and the Princess IV (思维题,排序?) Description "OK, you are not too bad, em... But ...

  3. CodeForces - 1102A(思维题)

    https://vjudge.net/problem/2135388/origin Describe You are given an integer sequence 1,2,-,n. You ha ...

  4. zoj 3778 Talented Chef(思维题)

    题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...

  5. cf A. Inna and Pink Pony(思维题)

    题目:http://codeforces.com/contest/374/problem/A 题意:求到达边界的最小步数.. 刚开始以为是 bfs,不过数据10^6太大了,肯定不是... 一个思维题, ...

  6. ZOJ 3829 贪心 思维题

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3829 现场做这道题的时候,感觉是思维题.自己智商不够.不敢搞,想着队友智商 ...

  7. 洛谷P4643 [国家集训队]阿狸和桃子的游戏(思维题+贪心)

    思维题,好题 把每条边的边权平分到这条边的两个顶点上,之后就是个sb贪心了 正确性证明: 如果一条边的两个顶点被一个人选了,一整条边的贡献就凑齐了 如果分别被两个人选了,一作差就抵消了,相当于谁都没有 ...

  8. C. Nice Garland Codeforces Round #535 (Div. 3) 思维题

    C. Nice Garland time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  9. PJ考试可能会用到的数学思维题选讲-自学教程-自学笔记

    PJ考试可能会用到的数学思维题选讲 by Pleiades_Antares 是学弟学妹的讲义--然后一部分题目是我弄的一部分来源于洛谷用户@ 普及组的一些数学思维题,所以可能有点菜咯别怪我 OI中的数 ...

随机推荐

  1. webpack构建vue单文件组件

    1.安装vue-loader和vue-template-compiler npm i vue-loader vue-template-compiler --save-dev 2.配置webpack.c ...

  2. webpack nodejs npm关系

    nodejs是js后端运行平台,可以把它看成java体系中对应的jdk,是三个里面最基础的.npm是nodejs的包管理工具,可以把它看成maven中包依赖管理那部分.webpack是前端工程化打包工 ...

  3. 【HDU - 1260 】Tickets (简单dp)

    Tickets 搬中文 Descriptions: 现在有n个人要买电影票,如果知道每个人单独买票花费的时间,还有和前一个人一起买花费的时间,问最少花多长时间可以全部买完票. Input 给出 N(1 ...

  4. idea生成构造方法的快捷键(看这篇就够了)

    使用快捷键能加快编写代码的速度和质量 idea生成构造方法的快捷键是Alt+Insert,然后选中Constructor

  5. ubuntu18.04误删apt-get命令恢复总结

    1.背景 由于使用aptitude命令替换了apt-get命令后感到后悔,想要恢复apt-get命令,特此总结以下踩过的坑 aptitude和apt-get的区别:https://www.cnblog ...

  6. linux centos7安装mysql8

    一.RPM版安装 查看是否有其他版本的数据库,若有,删除干净 非root用户必须要有sudo权限 1.下载mysql相关安装包 https://mirrors.tuna.tsinghua.edu.cn ...

  7. Leetcode 与树(TreeNode )相关的题解测试工具函数总结

    最近在剑指Offer上刷了一些题目,发现涉及到数据结构类的题目,如果想在本地IDE进行测试,除了完成题目要求的算法外,还需要写一些辅助函数,比如树的创建,遍历等,由于这些函数平时用到的地方比较多,并且 ...

  8. adams技巧汇总

    T+左键        平动模型 R+左键        旋转模型 Z+左键        动态缩放 F或Ctrl+F     以最大比例全面显示模型 S+左键        沿着垂直于屏幕的轴线旋转 ...

  9. 查看mysql是否锁表了

    1.查看表是否被锁: (1)直接在mysql命令行执行:show engine innodb status\G. (2)查看造成死锁的sql语句,分析索引情况,然后优化sql. (3)然后show p ...

  10. nodejs编程优化

    如何编写优化的 JavaScript 对象属性的顺序:始终以相同的顺序实例化对象属性,以便共享的隐藏类和随后优化的代码可以共享之.   动态属性:在实例化之后向对象添加属性将强制执行隐藏的类更改,并降 ...