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 comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.