ZCMU-巴什博弈
来源:互联网 发布:理肤泉和雅漾喷雾 知乎 编辑:程序博客网 时间:2024/05/21 01:55
Problem E: Problem E: A multiplication game
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 46 Solved: 29
[Submit][Status][Web Board]
Description
Problem E: A multiplication game
Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p = 1, does his multiplication, then Ollie multiplies the number, then Stan and so on. Before a game starts, they draw an integer 1 < n < 4294967295 and the winner is who first reaches p >= n. Each line of input contains one integer number n. For each line of input output one line either
Stan wins.
or
Ollie wins.
assuming that both of them play perfectly.
Input
Output
Sample Input
162
17
34012226
Sample Output
Stan wins.
Ollie wins.
Stan wins.
【解析】
这道题巴什博奕论,意思就是找规律喽,我们发现如果输入的是2-9就是stan胜利,因为是stan选出手,如果是10-18
了,如果超过了18那就是小于等于162,那就是stan胜利了,因为18*9=162这样推着推着我们发现其实就是不断的除
18,如果最好得到小于等于9的数那就是stan胜利。2-9肯定是stan胜利,10-18肯定是online,19-162只要stan不傻
他都能胜利
这道题巴什博奕论,意思就是找规律喽,我们发现如果输入的是2-9就是stan胜利,因为是stan选出手,如果是10-18
了,如果超过了18那就是小于等于162,那就是stan胜利了,因为18*9=162这样推着推着我们发现其实就是不断的除
18,如果最好得到小于等于9的数那就是stan胜利。2-9肯定是stan胜利,10-18肯定是online,19-162只要stan不傻
他都能胜利
#include<iostream>#include<string>#include<map>#include<cstring>#include<cstdio>using namespace std;double n;int main(){while(~scanf("%lf",&n)){ while(n>18) n=n/18; if(n>9) printf("Ollie wins.\n"); else printf("Stan wins.\n");} return 0;}
0 0
- ZCMU-巴什博弈
- 博弈-巴什博弈
- 巴什博弈+威佐夫博弈+Nim博弈
- 博弈入门---(巴什博弈,威佐夫博弈,nim博弈)
- 博弈中的巴什博弈
- 巴什博弈威佐夫博弈
- 尼姆博弈和巴什博弈
- (博弈)巴什博弈hdu1846Brave Game
- (博弈)Public SaleHDU2149(巴什博弈)
- 简单博弈——巴什博弈
- zcmu-1113取石子游戏(威佐夫博弈)
- 巴什博弈
- 巴什博弈
- HDU2147 巴什博弈
- hdu1846巴什博弈
- 巴什博弈
- POJ2368 巴什博弈
- 巴什博弈
- Hadoop学习路线
- Linux 同步机制:读写锁
- 硬链接与软连接的区别
- 【caffe源码研究】第三章:源码篇(5) :Net
- Java序列化(Serializable)与反序列化
- ZCMU-巴什博弈
- HTTP学习笔记:Web与网络基础
- 关于Python的 求解答Bunch Pattern
- 1003. Emergency 解析
- C#中yield return用法分析
- windows 一些冷知识
- 面向对象的过程
- 写在前面的话
- SSM框架简单介绍以及maven环境搭建