Follows 10424.c (Total 50 lines):

/* @JUDGE_ID:4461XX 10424 C++ */
/* A */
#include<stdio.h>
#define MAXLENGTH 100

class personValue{
		int val ;
	public :
		personValue( char *name )
		{
			val = 0 ;

			for( int i=0 ; name[i] ; ++i ){
				if( 'a'<=name[i]&&name[i]<='z' )
					val += name[i]-'a'+1 ;
				if( 'A'<=name[i]&&name[i]<='Z' )
					val += name[i]-'A'+1 ;
			}

			while( val>=10 ){
				int tmp=val ;
				
				for( val=0 ; tmp ; ){
					val += tmp%10 ;
					tmp /=10 ;
				}
			}
		}
		int getVal()
		{
			return val ;
		}
} ;
int main( void )
{
	char name1[MAXLENGTH] ;
	char name2[MAXLENGTH] ;
	
	while( gets( name1 ) ){
		gets( name2 ) ;

		personValue a( name1 ) , b( name2 ) ;
		if( a.getVal()>b.getVal() )
			printf( "%.2f %c\n" , 100.0*(double)b.getVal()/(double)a.getVal() , '%' ) ;
		else
			printf( "%.2f %c\n" , 100.0*(double)a.getVal()/(double)b.getVal() , '%' ) ;
	}

	return 0 ;
}

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