题目: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; }