Follows 10221.c (Total 26 lines):

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

#define R 6440.0
#define M_PI 3.141592653589793

int main( void )
{
	double s , a ;
	char str[4] ;

	while( scanf( "%lf %lf %s\n" , &s , &a , str )==3 ){
		if( !strcmp( str , "min" ) ) a /= 60.0 ;
		
		a = fmod( a , 360.0 ) ;
		if( a>180.0 ) a = 360-a ;
		a = a*M_PI/180.0 ;

		printf( "%.6f %.6f\n" , ( R+s )*a , 2.0*( R+s )*sin( a/2.0 ) ) ; 
	}

	return 0 ;
}

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