A multiplication game
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 6028   Accepted: 3013

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


手算一下吧
0~9 stan
10~9*2 ollie  //2是Stan,他要尽量阻止Ollie取到n;9是Ollie,他要尽量大来取到n
19~9*2*9 stan
以此类推
可以直接用n不断/18
注意double n
#include<cstdio>
double n;
int main(){
while(scanf("%lf",&n)!=EOF){
while(n>) n/=;
if(n<=) puts("Stan wins.");
else puts("Ollie wins.");
}
}

POJ2505 A multiplication game[博弈论]的更多相关文章

  1. POJ2505 A multiplication game 博弈论 找规律

    http://poj.org/problem?id=2505 感觉博弈论只有找规律的印象已经在我心中埋下了种子... 题目大意:两个人轮流玩游戏,Stan先手,数字 p从1开始,Stan乘以一个2-9 ...

  2. [poj2505]A multiplication game_博弈论

    A mutiplication game poj-2505 题目大意:给定一个数n和p,两个选手每次可以将p乘上[2,9].最先使得p大于n的选手胜利. 注释:$1\le n\le 429496729 ...

  3. 「POJ2505」A multiplication game [博弈论]

    题目链接:http://poj.org/problem?id=2505 题目大意: 两个人轮流玩游戏,Stan先手,数字 p从1开始,Stan乘以一个2-9的数,然后Ollie再乘以一个2-9的数,直 ...

  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. POJ2505 A multiplication game(博弈)

    题意 开始时$p = 1$,每次可以乘$2 - 9$,第一个使得$p \geqslant n$的人赢 问先手是否必胜 $1 <n <4294967295$ Sol 认真的推理一波. 若当前 ...

  6. [poj2505]A multiplication game

    首先有SG(k)=mex(SG(k/2),SG(k/3)--SG(k/9)),SG(0)=0,通过打表可以发现当$n\in[1,1]\cup [10,18]\cup [163,324]--$,规律大概 ...

  7. 博弈论BOSS

    基础博弈的小结:http://blog.csdn.net/acm_cxlove/article/details/7854530 经典翻硬币游戏小结:http://blog.csdn.net/acm_c ...

  8. poj分类解题报告索引

    图论 图论解题报告索引 DFS poj1321 - 棋盘问题 poj1416 - Shredding Company poj2676 - Sudoku poj2488 - A Knight's Jou ...

  9. 【Mark】博弈类题目小结(HDU,POJ,ZOJ)

    转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 首先当然要献上一些非常好的学习资料: 基础博弈的小 ...

随机推荐

  1. webserver[实时查询当天的天气情况]

    1.webserver是什么? 日常生活中经常会使用到webserver,注册时,会收到验证码,购买东西时,会收到短信,假如,A公司网站和B公司合作,那么A公司注册对的用户可以直接推送给B网站,那怎么 ...

  2. Artificial intelligence(AI)

    ORM: https://github.com/sunkaixuan/SqlSugar 微软DEMO: https://github.com/Microsoft/BotBuilder 注册KEY:ht ...

  3. js动态的把左边列表添加到右边,可上下移动。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. GTD工具 Wunderlist使用心得总结

    前言: 先后使用过do.it.omnifocus,最后选择了wunderlist,看了他拓展性强.跨平台.免费三大优点.Wunderlist只是一个工具,重要是的GTD的思路.下面的分享是本人的使用案 ...

  5. DecoratorPattern(装饰器模式)

    /** * 装饰者模式 * @author TMAC-J * 总的来说,装饰者模式就是继承的应用 */ public class DecoratorPattern { interface Beans{ ...

  6. jQuery AutoComplete 自动补全

    jQuery.AutoComplete是一个基于jQuery的自动补全插件.借助于jQuery优秀的跨浏览器特性,可以兼容Chrome/IE/Firefox/Opera/Safari等多种浏览器. 特 ...

  7. git将本地仓库推送到远程仓库

    如何将本地仓库推送到公司远程仓库? 1:前提是你本地安装好git.先把远程git仓库克隆到本地  git clone 远程仓库的地址(SSH) 2: git  branch //查看本地分支 3: g ...

  8. jQuery基础知识总结

    1.  jQuery基本概念介绍             1.1 什么是jQuery 一个javascript库,把常用方法写到一个js文件中,需要的时候直接调用即可 学习jQuery就是学习一些方法 ...

  9. div盒子垂直水平居中

    div盒子,水平垂直居中. <!DOCTYPE html><html> <head> <meta charset="utf-8"> ...

  10. iOS之数组的排序(升序、降序及乱序)

    #pragma mark -- 数组排序方法(升序) - (void)arraySortASC{ //数组排序 //定义一个数字数组 NSArray *array = @[@(3),@(4),@(2) ...