| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 699 人关注过本帖
标题:[求助]谁赢得问题!
取消只看楼主 加入收藏
zhanghuan_10
Rank: 1
等 级:新手上路
威 望:2
帖 子:751
专家分:0
注 册:2006-10-25
收藏
 问题点数:0 回复次数:3 
[求助]谁赢得问题!

A Multiplication Game

--------------------------------------------------------------------------------

Time limit: 1sec. Submitted: 143
Memory limit: 32M Accepted: 78

Source : Waterloo ACM Programming Contest Sep 22, 2001

--------------------------------------------------------------------------------

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.

搜索更多相关主题的帖子: game his numbers always Memory 
2006-12-10 16:41
zhanghuan_10
Rank: 1
等 级:新手上路
威 望:2
帖 子:751
专家分:0
注 册:2006-10-25
收藏
得分:0 
好吧!我在好好想想吧!我有些想不明白p到底都和谁乘2到9吗!
对了!你是怎么知道咱们是一个学校的!呵呵!还是学长呢!以后请多关照!呵呵!

该学习了。。。
2006-12-10 16:58
zhanghuan_10
Rank: 1
等 级:新手上路
威 望:2
帖 子:751
专家分:0
注 册:2006-10-25
收藏
得分:0 

以后得自己多想想了!咱们专业以后是不是课更多了!这是我写的!错了!让我自己再想想!
#include <stdio.h>

int main()
{
int m;

while(scanf("%d", &m) != EOF)
{
while(1)
{
if(m > 9&&m <= 18)
{
printf("Ollie wins.\n");
break;
}
else if(m <= 9&&m > 0)
{
printf("Stan wins.\n");
break;
}
m /= 18;
}
}

return 0;

}


该学习了。。。
2006-12-10 17:46
zhanghuan_10
Rank: 1
等 级:新手上路
威 望:2
帖 子:751
专家分:0
注 册:2006-10-25
收藏
得分:0 
呵呵!它给的测试数据很大!而我只用了int所以错了!通过了!多谢学长了!

该学习了。。。
2006-12-10 17:59
快速回复:[求助]谁赢得问题!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018548 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved