vjudge A Funny Game 思维题 (其实今天讲的全是数学。。。)
原文链接https://vjudge.net/contest/331993#problem/H
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
6). There are no blank lines between cases. A line with a single 0 terminates the input.
Output
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 思维题 (其实今天讲的全是数学。。。)的更多相关文章
- 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 ...
- 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 ...
- CodeForces - 1102A(思维题)
https://vjudge.net/problem/2135388/origin Describe You are given an integer sequence 1,2,-,n. You ha ...
- zoj 3778 Talented Chef(思维题)
题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...
- cf A. Inna and Pink Pony(思维题)
题目:http://codeforces.com/contest/374/problem/A 题意:求到达边界的最小步数.. 刚开始以为是 bfs,不过数据10^6太大了,肯定不是... 一个思维题, ...
- ZOJ 3829 贪心 思维题
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3829 现场做这道题的时候,感觉是思维题.自己智商不够.不敢搞,想着队友智商 ...
- 洛谷P4643 [国家集训队]阿狸和桃子的游戏(思维题+贪心)
思维题,好题 把每条边的边权平分到这条边的两个顶点上,之后就是个sb贪心了 正确性证明: 如果一条边的两个顶点被一个人选了,一整条边的贡献就凑齐了 如果分别被两个人选了,一作差就抵消了,相当于谁都没有 ...
- 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 ...
- PJ考试可能会用到的数学思维题选讲-自学教程-自学笔记
PJ考试可能会用到的数学思维题选讲 by Pleiades_Antares 是学弟学妹的讲义--然后一部分题目是我弄的一部分来源于洛谷用户@ 普及组的一些数学思维题,所以可能有点菜咯别怪我 OI中的数 ...
随机推荐
- ES6 - 基础学习(4): 模板字符串和字符串新增方法
模板字符串 模板字符串:我理解为将字符串格式化.模板化,将字符串加强处理,此处的模板有动词的意思. 字符串模板基本格式: `xxxxxx`(前后都用反引号[tab键上面按键]引起来).除了作为普通字符 ...
- docker jenkins 安装
1:官方教程 https://jenkins.io/zh/doc/book/installing/ 2:拉取jenkins镜像 docker pull jenkinsci/blueocean 3:输入 ...
- 2019-2020-2 20175121杨波《网络对抗技术》第一周kali的安装
2019-2020-2 20175121杨波<网络对抗技术>第一周kali的安装 标签 : Linux 一.下载安装kali 1.下载kali 下载链接 打开链接进入官网后,点击Torre ...
- 解决“此Flash Player与您的地区不相容”
1.进入C:\Windows\System32\drivers\etc目录,将hosts文件拷贝到桌面,然后用文本编辑器,比如记事本,打开,在最后一行添加: 127.0.0.1 geo2.adobe. ...
- python学习---文件修改
1.读一行,写一行,判断字符串,修改之. f=open("yesterday2","r",encoding="utf-8") f_new=o ...
- 浅谈 vue-loader---合格前端
什么是 vue-loader? vue-loader 是一个 webpack 的 loader,它允许你以一种名为单文件组件的格式撰写 Vue 组件. 如何使用? 1. 安装 npm install ...
- 内网学习之MySQL服务提权
利用MySQL提权原理: 1.具有mysql的root权限,且mysql以system权限运行. 2.具有执行sql语句的权限,webshell或者外连皆可 UDF提权 UDF(user define ...
- 使用vscode阅读C代码outline不显示问题
1 问题:使用vscode code 阅读C代码 outline 显示No symbols found in document 'xxxx' 2 参考网上解决方法,进行如下操作 2.1 安装C/C+ ...
- linux 下生成 ssh 公私钥
生成命令 ssh-keygen -t rsa -C "763941715@qq.com" 密匙目录 cd ~/.ssh 公钥 id_rsa.pub 私钥 id_rsa
- clientHeight offsetTop scrollTop