Follows 10530.c (Total 53 lines):

/* @JUDGE_ID:4461XX 10530 C */
/* A */
#include<stdio.h>
#include<string.h>

int main( void )
{
	int num, lie;
	int lowerBound, upperBound;
	char response[16];
	
	while( scanf( "%d\n", &num ) ){
		if( num==0 )
			break;

		lowerBound = 1;
		upperBound = 10;
		lie = 0;

		for( ; gets( response ); scanf( "%d\n", &num ) ){
			if( !strcmp( response, "right on" ) ){
				if( !lie )
					if( lowerBound>num || num>upperBound )
						lie = 1;
				break;
			}
			if( lie )
				continue;

			if( !strcmp( response, "too high" ) ){
				if( num<lowerBound )
					lie = 1;
				else if( num<=upperBound )
					upperBound = num-1;
			}
			else{ /* if( !strcmp( response, "too low" ) ) */
				if( num>upperBound )
					lie = 1;
				else if( num>=lowerBound )
					lowerBound = num+1;
			}
			if( upperBound<lowerBound )
				lie = 1;
		}

		if( lie )
			puts( "Stan is dishonest" );
		else
			puts( "Stan may be honest" );
	}

	return 0;
}

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com