Follows 102.c (Total 32 lines):

/* @JUDGE_ID:4461XX 102 C */
/* A */
#include <stdio.h>
void main( void )
{
	int b[3] , g[3] , c[3] ; char array[3];
	while( scanf( "%d %d %d %d %d %d %d %d %d" , &b[0] , &g[0] , &c[0] , &b[1] , &g[1] , &c[1] , &b[2] , &g[2] , &c[2] ) == 9 )
	{
		int i , j , k , big , b1 = 0 , g1 = 0 , c1 = 0;
		for( i = 0 ; i < 3 ; i++ ) { b1 += b[i] ; g1 += g[i] ; c1 += c[i] ; }
		big = b1 + g1 + c1 ;
		for( i = 0 ; i < 3 ; i++ )
		{
			for( j = 0 ; j < 3 ; j++ )
			{
				for( k = 0 ; k < 3 ; k++ )
				{
					while ( i != j && j != k && i != k )
					{
						if( b1 - b[i] + g1 - g[k] + c1 - c[j] < big )
						{
							big = b1 - b[i] + g1 - g[k] + c1 - c[j] ;
							array[i] = 'B' ; array[k] = 'G' ; array [j] = 'C' ;
						}
						break ;
					}
				}
			}
		}
		printf( "%c%c%c %d\n" , array[0] , array[1] , array[2] , big ) ;
	}
}

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