HDU(1517)A Multiplication Game(博弈)

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1517

题意:2 个人玩游戏,从 1 开始,轮流对数进行累乘,直到超过一个指定的值。

[2,9] Stan wins.

[10,18] Ollie wins.

[19,162] Stan wins.

[162,324]Ollie wins.

...

...

 

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <vector>
using namespace std;

int main (){
    double n;
    while (cin>>n){
        while(n>18) n/=18;
        //cout<<n<<endl;
        if (n>9)
            printf("Ollie wins.\n");
        else
            printf("Stan wins.\n");
    }
    return 0;
}

 

转载于:https://www.cnblogs.com/Roly/archive/2013/05/15/3079837.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值