Follows 278.c (Total 30 lines):

/* @JUDGE_ID:4461XX 278 C */
/* A */
#include<stdio.h>
int min( int m , int n )
{
	if( m < n ) return m ;
		return n ;
}
void main( void )
{
	int k , i , m , n ;
	char c ;
/*	freopen( "C:\\windows\\desktop\\278.in" , "r" , stdin ) ;*/
	scanf( "%d\n" , &k ) ;
	for( i=0 ; i<k ; i++ ){
		scanf( "%c %d %d\n" , &c , &m , &n ) ;
		/* DP */
		switch ( c ){
			case 'r' :
			case 'Q' : printf( "%d\n" , min( m , n ) ) ;
						  break ;
			case 'k' : printf( "%d\n" , m * n / 2 ) ;
						  break ;
			case 'K' : if( m % 2 ) m++ ;
						  if( n % 2 ) n++ ;
						  printf( "%d\n" ,  m *  n / 4 ) ;
						  break ;
		}
	}
}

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