ACM (UVa) : 847


#include <stdio.h>

int main ()
{
	long n;

	while ( scanf ("%lld", &n) != EOF ) {

		long p = 1;
		bool stan = true;
		bool ollie = false;

		while ( p < n ) {
			
			if ( stan ) {
				p *= 9;
				stan = false;
				ollie = true;
			}

			else {
				p *= 2;
				ollie = false;
				stan = true;
			}
		}

		if ( ! stan )
			printf ("Stan wins.\n");
		else
			printf ("Ollie wins.\n");
	}

	return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s