poj 2484 A Funny Game(博弈)
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 4639 | Accepted: 2855 |
Description

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
Output
Sample Input
1
2
3
0
Sample Output
Alice
Alice
Bob
Source
【思路】
博弈
当n<3时有Alice必胜,n=3时Bob胜,当n>3时,无论Alice如何操作,Bob总可以通过操作使得剩下两条完全相同的链,之后通过对称Alice的操作最终获胜。
【代码】
#include<cstdio> int main() {
int n;
while(scanf("%d",&n)== && n) {
if(n>=) puts("Bob");
else puts("Alice");
}
return ;
}
poj 2484 A Funny Game(博弈)的更多相关文章
- POJ 2484 A Funny Game [博弈]
题意:n枚硬币围成一个圈,每次每个人可以从中取走一枚或者相邻的两枚(如果两枚硬币原本中间隔着一枚硬币,后来被取走,这两枚硬币不算相邻).谁取走最后一枚硬币谁就赢了. 思路:我们可以找找规律. 首先,n ...
- POJ 2484(对称博弈)
题目链接:http://poj.org/problem?id=2484 这道题目大意是这样的,有n个硬币围成一圈,两个人轮流开始取硬币(假设他们编号从1到n),可以选择取一枚或者取相邻的两枚(相邻是指 ...
- POJ 2484 A Funny Game 博弈论 对称博弈
http://poj.org/problem?id=2484 1和2时Alice必胜,3时Bob必胜,其他情况下Bob只需要在Alice取过之后取一次将剩下的硬币链平均分为两份,然后Alice怎么取B ...
- POJ 2484 A Funny Game【博弈】
相比数据结构的题..感觉这种想啊想的题可爱多了~~~代码量还少.... 题目链接: http://poj.org/problem?id=2484 题意: 一圈n个硬币,两人轮流从中取一或两个硬币,(只 ...
- POJ 2484 A Funny Game(智商博弈)
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6397 Accepted: 3978 Description Alice ...
- POJ Football Game 【NIMK博弈 && Bash 博弈】
Football Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 451 Accepted: 178 Descr ...
- POJ 2484 A Funny Game(神题!)
一开始看这道博弈题的时候我就用很常规的思路去分析了,首先先手取1或者2个coin后都会使剩下的coin变成线性排列的长条,然后无论双方如何操作都是把该线条分解为若干个子线条而已,即分解为若干个子游戏而 ...
- POJ 2484
A Funny Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3861 Accepted: 2311 Desc ...
- [原博客] POJ 2484 A Funny Game
题目链接题意:有n个硬币排成一圈,两个人轮流操作,每次可以取走一个或者相邻的连个硬币(只算最开始相邻的,取之后才相邻的不算),问先手必胜还是必败. 这个题可以证明若n>=3,则先手必败.对称博弈 ...
随机推荐
- jquery 移除数组重复的元素----$.unique()
举例说明: var fruits=["apple","banana","pear","orange","ba ...
- POJ 3280 Cheapest Palindrome(DP 回文变形)
题目链接:http://poj.org/problem?id=3280 题目大意:给定一个字符串,可以删除增加,每个操作都有代价,求出将字符串转换成回文串的最小代价 Sample Input 3 4 ...
- wamp不能使用phpmyadmin,提示“You don't have permission to access /phpmyadmin/ on this server.” 转载
换了win8之后wamp明显不怎么好用了,显示80端口被system占用,后是masql出现了403错误,多番百度谷歌找到了解决方案,这里与大家分享 当你安装完成wamp后,打开localhost或i ...
- 对N个数组进行操作。先把这N个一维数组合并成一个2为数组;然后进行操作
using System;using System.Collections.Generic;using System.Linq;using System.Collections;using Syste ...
- ZOJ 2015 10月份 月赛 3911 Prime Query
这道题我改啊,改啊,交啊,就对了. #include <stdio.h> #include <stdlib.h> #include <math.h> #includ ...
- jquery 属性与css操作
属性1.属性 1.1 attr(name|properties|key,value|key,fn) 1) 获取属性值 $("img").attr(&quo ...
- PHPUnit测试
今天单元测试测到一个有点坑的小问题: public function testUpdataStatusFailForNegative() { // // Remove the following li ...
- jquery技巧(持续更新。。)
(1)集合处理功能 //为索引为0,1,2的元素分别设置不同的字体颜色 $('p').each(function(i){ this.styl ...
- __isset()检测类内部变量是否设置
__isset()--检测类内部私有变量是否存在 当执行isset方法时自动执行 class Per{ private $name; private $age; function __construc ...
- 运用预加载提升H5移动页面的用户体验
原文地址:http://www.grycheng.com/?p=2188 在做h5移动页面,相信大家一定碰到过页面已经打开,但是里面的图片还未加载出来的情况,这种问题虽然不影响页面的功能,但是不利于用 ...