A Multiplication Game

Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 4633    Accepted Submission(s): 2631

Problem Description
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.
 
Input
Each line of input contains one integer number n.
 
Output
For each line of input output one line either 



Stan wins. 



or 



Ollie wins.



assuming that both of them play perfectly.
 
Sample Input
162
17
34012226
 
Sample Output
Stan wins.
Ollie wins.
Stan wins.
 
Source
 
Recommend
LL   |   We have carefully selected several similar problems for you:  1404 1079 1536 2147 1850 
 

你  离  开  了  ,  我  的  世  界  里  只  剩  下  雨  。  。  。

#include <iostream>
using namespace std;
int main()
{
double n;
while(cin>>n)
{
while(n > 18)n/=18;
if(n <= 9)cout << "Stan wins." << endl;
else cout << "Ollie wins." << endl;
}
return 0;
}

HDU 1517:A Multiplication Game的更多相关文章

  1. HDU 1517 A Multiplication Game (博弈)

    A Multiplication Game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...

  2. hdu 1517 A Multiplication Game 段sg 博弈 难度:0

    A Multiplication Game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...

  3. hdu 1517 A Multiplication Game(必胜态,必败态)

    A Multiplication Game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...

  4. hdu 1517 A Multiplication Game 博弈论

    思路:求必胜区间和必败区间! 1-9 先手胜 10-2*9后手胜 19-2*9*9先手胜 163-2*2*9*9后手胜 …… 易知右区间按9,2交替出现的,所以每次除以18,直到小于18时就可以直接判 ...

  5. (step8.2.7)hdu 1517(A Multiplication Game——巴什博弈变形)

    题目大意:输入一个整数n.谁先报的数大于n,谁就输了.(初始值p  == 1 , 后一个人报的数必须在前一个人报的数的基础上乘上(2 ~ 9)之间的任意一个数) 解题思路:巴什博奕的变形 1) 解题思 ...

  6. HDU 1517 A Multiplication Game 博弈

    题目大意:从1开始Stan与Ollie经行博弈,stan先手,每次将当前数乘上(2~9)间的任意数,最后一次操作后大于等于n的人获胜. 题目思路: 1-9 stan 胜 10-18 ollie胜 19 ...

  7. HDU 1517 A Multiplication Game (SG函数找规律)

    题意:两个玩家玩一个游戏,从 p = 1,开始,然后依次轮流选择一个2 - 9的数乘以 p,问你谁先凑够 p >= n. 析:找规律,我先打了一下SG函数的表,然后就找到规律了 我找到的是: 1 ...

  8. HDU 4920 Matrix multiplication(bitset)

    HDU 4920 Matrix multiplication 题目链接 题意:给定两个矩阵,求这两个矩阵相乘mod 3 思路:没什么好的想法,就把0的位置不考虑.结果就过了.然后看了官方题解,上面是用 ...

  9. 【hdu 1517】A Multiplication Game

    Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s) ...

随机推荐

  1. 学习 Qt 编程的好书精品推荐!

    最近一段时间,准备开始搞Qt方面的东西,想找几本书看看.网上介绍QT的书籍也有很多,不想浪费时间,所以想找几本精品的书籍来看.花了半天的时间找了几本非常不错的,这里面整理好之后推荐给大家! 下面介绍的 ...

  2. Buffer.alloc()

    Buffer.alloc(size[, fill[, encoding]]) Node.js FS模块方法速查 size {Number} fill {Value} 默认:undefined enco ...

  3. 用element-ui的走马灯carousel轻松实现自适应全屏banner图

    写在前面:网站轮播图建议使用swiper组件,非常方便快捷.vue轮播图插件之vue-awesome-swiper 接手一个项目,轮播图是用element-ui的carousel实现的,看起来效果还不 ...

  4. 合办大学 -- internal campus in China

    * 合办大学 -- internal campus in China- international campus zhejiang University- 南方科技大学 - 西交利物浦大学(Xi’an ...

  5. 100ns周期200ns的正脉冲波形形状描述

    用FPGA控制16245产生正脉冲,正脉冲的形状是上升会有过冲现象,下降会有震荡产生,做了个实验室,用同轴电缆承载这种信号,在同轴电缆的末端会产生的波形是标准的衰减震荡. (简单的入pcb,经过继电器 ...

  6. KNN-K近邻算法(1)

    KNN(K-nearest neighbors) 思想简单 数学所需知识少(近零) 效果好 可解释机器学习算法使用过程中的很多细节问题 更完整的刻画机器学习应用的流程 天然可解决多分类问题 可解决回归 ...

  7. 学习使用windows下类似iptables的防火墙软件

    项目地址:http://wipfw.sourceforge.net一.下载地址:http://sourceforge.net/projects/wipfw/files/安装:解压软件包后执行insta ...

  8. hdu 1075 字典树

    #include<stdio.h> #include<iostream> struct node { int num,i; node *a[27]; char s[20];// ...

  9. bzoj 2223 [Coci 2009]PATULJCI

    [Coci 2009]PATULJCI Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1286  Solved: 553[Submit][Status ...

  10. HDU - 2059 龟兔赛跑(多阶段决策dp)

    http://acm.hdu.edu.cn/showproblem.php?pid=2059 初始把起点和终点也算做充电站,设dp[i]是到第i个充电站的最短时间,那么dp[n+1]即是乌龟到达终点的 ...