lzh

刘政
posts - 17, comments - 1, trackbacks - 0, articles - 1

UVa 847(博弈问题)

Posted on 2010-08-25 19:46 lzh525 阅读(214) 评论(0)  编辑 收藏 引用
 1#include <iostream>
 2#include<cmath>
 3using namespace std;
 4
 5typedef unsigned long int ULI;
 6
 7bool stanWin(ULI n)
 8{
 9    if (2<=n&&n<=9)
10        return true;
11    else  
12        return false;
13}

14
15int main()
16{
17    ULI n;
18    while(cin>>n)
19    {
20        while(n>18)
21        {
22           n=ceil(n/18.0);
23        }

24        if(stanWin(n))        
25            cout << "Stan wins."<<endl;
26        else
27            cout << "Ollie wins."<<endl;
28    }

29    return 0;
30}

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理