POJ - 2505 A multiplication game

https://vjudge.net/problem/POJ-2505

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n)
	{
		int f=0;
		while(n>1)
		{
			if(f)
			{
				if(n%2==0) n=n/2;  //向上取整 
				else n=n/2+1;	
			}
			else
			{
				if(n%9==0) n=n/9;
				else n=n/9+1;	
			}
			f=!f;
		}
   		if(f) cout<<"Stan wins.\n";
        else cout<<"Ollie wins.\n";
	}
	return 0; 
}
上一篇:zzulioj 1101: 逆序数字(函数专题)


下一篇:Python 3基础教程16-类