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. Linux环境下c程序的编译和执行

    1 单个文件的编译和执行创建main.c文件,内容如下: #include <stdio.h> #include <stdlib.h> int main(void){ prin ...

  2. Vue如何实现swiper左右滑动内容区控制导航tab同时切换高亮

    Vue如何实现左右滑动内容区控制导航tab同时切换高亮,实现的效果是:点击导航按钮时内容区发生改变,左右滑动内容区时导航按钮跟随切换高亮,停留在某个内容区时刷新页面后仍然停留在当前内容区.       ...

  3. Direct3D 12 创建windows窗口

    之前列出了计算机图形学的计划,现在开始这一阶段的学习,首先是Windows窗口的创建. 创建windows窗口 环境: 1. Visual Studio 2015 新建项目 创建工程项目完成,确定为窗 ...

  4. 【Codeforces 1031C】Cram Time

    [链接] 我是链接,点我呀:) [题意] 题意 [题解] 如果找到最大的n使得1+2+...+n<=a+b 然后第一天输出1,2.3,4....t1 这里1+2+..+t1<=a 这还远远 ...

  5. POJ-3041 Asteroids,二分匹配解决棋盘问题。

    Asteroids Time Limit: 1000MS   Memory Limit: 65536K       Description Bessie wants to navigate her s ...

  6. [BZOJ2667][cqoi2012]模拟工厂

    [BZOJ2667][cqoi2012]模拟工厂 试题描述 有一个称为“模拟工厂”的游戏是这样的:在时刻0,工厂的生产力等于1.在每个时刻,你可以提高生产力或者生产商品.如果选择提高生产力,在下一个时 ...

  7. hdu 5073 推公式相邻质心转换

    #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 51000 int cmp(co ...

  8. 【BZOJ3925】地震后的幻想乡(期望概率DP,状压DP)

    题意:给定一张点数不超过10的无向连通图,每条边有一个[0,1]之间的随机权值,求最小生成树上最大边的期望值 提示:对于n个[0,1]之间的随机变量x1,x2,...,xn,第k小的那个的期望值是k/ ...

  9. P1631 序列合并 洛谷

    https://www.luogu.org/problem/show?pid=1631 题目描述 有两个长度都是N的序列A和B,在A和B中各取一个数相加可以得到N^2个和,求这N^2个和中最小的N个. ...

  10. Validate Binary Search Tree(DFS)

    Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as ...