Follows 384.c (Total 67 lines):

/* @JUDGE_ID:4461XX 384 C */
/* A */
#include<stdio.h>
char arr[80] ;
int i ;
int IsSlump( void )
{
	i++ ;
	if( arr[i] )
		if( arr[i]=='D' || arr[i]=='E' )
			if( arr[++i]=='F' ){
				for( i++ ; ; i++ )
					if( arr[i]!='F' ) break ;

				if( arr[i]=='G' ) return 1 ;
				i-- ;
				if( IsSlump() ) return 1 ;
			}

	return 0 ;
}
int IsSlimp( void )
{
	i++ ;
	if( arr[i]!='A' ) return 0 ;

	i++ ;
	if( arr[i] ){
		if( arr[i]=='H' ) return 1 ;
		if( arr[i]=='B' )
			if( IsSlimp() ){
				i++ ;
				if( arr[i]=='C' ) return 1 ;
				else return 0 ;
			}
			else return 0 ;

		i-- ;
		if( IsSlump() ){
			i++ ;
			if( arr[i]=='C' ) return 1 ;
			else return 0 ;
		}
	}

	return 0 ;
}
void main( void )
{
	int n , yes=1 ;
/*	freopen( "C:\\windows\\desktop\\384.in" , "r" , stdin ) ;*/
	scanf( "%d\n" , &n ) ;
	puts( "SLURPYS OUTPUT" ) ;
	for( ; n ; n-- ){
		gets( arr ) ;
		i = -1 ;

		while( yes && arr[i+1] ){
			yes = IsSlimp() ;
			if( yes ) yes = IsSlump() ;
		}

		if( yes ) puts( "YES" ) ;
		else puts( "NO" ) ;
	}
	puts( "END OF OUTPUT" ) ;
}

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