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. js页面跳转定位

    A页面 <!DOCTYPE html> <html> <head> <meta name="viewport" content=" ...

  2. 初识 Spring 框架

    初识 Spring 框架可以帮助我们构建规范的.优秀的应用程序,简化烦琐的编码过程. Spring 是一个非常著名的轻量级的企业级开源框架,Spring 的目标是使 Java EE 更易用并促进良好的 ...

  3. U盘启动盘制作工具(安装Linux)

    2018-09-15 17:36:42 1. Etcher  官网:https://etcher.io/ 资料来源:https://linuxmint-installation-guide.readt ...

  4. ORM之连表操作

    ORM之连表操作 -----------------------------连表的正向操作------------------------- 在models.py中创建两张表UserType和User ...

  5. Ubuntu中Python3虚拟环境的搭建

    1.环境准备 首先请自行安装好Python3和pip3(一般Ubuntu是自带Python3的,可以通过sudo apt-get install python3-pip命令来安装pip3) 安装完成后 ...

  6. jquery 修改input输入框的 readOnly属性 && input输入框隐藏

    html的代码 <div class="control-group"> <label class="control-label required&quo ...

  7. 集训第四周(高效算法设计)J题 (中途相遇法)

    Description   The SUM problem can be formulated as follows: given four lists A, B, C, D<tex2html_ ...

  8. Webdriver概述(selenium对应浏览器版本)

    Webdriver (Selenium2)是一种用于Web应用程序的自动测试工具,它提供了一套友好的API,与Selenium 1(Selenium-RC)相比,Webdriver 的API更容易理解 ...

  9. Codeforces713D. Animals and Puzzle

    $n<=1000,m<=1000$,$n*m$的01矩阵,给$t<=1000000$个询问,每次问一个矩形中最大的1正方形的边长. 先想想不考虑“一个矩形中”的限制,那记$f(i,j ...

  10. Ubuntu清理内存命令(效果不明显)

    注意:最好不要在生产环境上使用!!! 1.检查内存使用情况 watch -n 3 free -m watch -n 3 cat /proc/meminfo 2.清理 #释放页缓存 echo 1 > ...