POJ 2505:A multiplication game
2016-01-31 14:39
337 查看
A multiplication game
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
Sample Output
Source
Waterloo local 2001.09.22
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 5624 | Accepted: 2813 |
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
Waterloo local 2001.09.22
你 离 开 了 , 我 的 世 界 里 只 剩 下 雨 。 。 。
#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; }
相关文章推荐
- wxPython大全
- win10 安装scrapy
- LeetCode53. Maximum Subarray
- C语言线段树
- signal 信号处理的一系列操作总结
- HDU1241 Oil Deposits
- Android Drawable
- HDU 1517:A Multiplication Game
- 解决登录WDCP面板出现"无法连接mysql,请检查mysql是否已启动"问题
- 通过进程名获取该进程所占CPU百分比
- Android应用程序资源的编译和打包过程分析
- C/C++中,优先级的那些事儿
- JavaSE入门学习20:Java面向对象之接口(interface)(一)
- java垃圾回收机制详解
- java dyn proxy
- Hybird App——cordova(原PhoneGap)安装配置
- Hybird App——cordova(原PhoneGap)安装配置
- android *** Layout 01
- hdu 2544最短路(Dijkstra)
- 使用CoordinatorLayout