Follows 10283.c (Total 33 lines):

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

const double pi=3.141592653589793 ;

int main( void )
{
	int R , N ;
	double degree , r , I , E ; 

	while( scanf( "%d %d" , &R , &N )==2 ){
		degree = pi/(double)N ;

		if( N==1 ){ /* special case */
			r = (double)R ;
			I = 0.0 ;
			E = 0.0 ;
		}
		else{
			r = (double)R/( 1.0+1.0/sin(degree) ) ;


			I = (double)N*r*r*( 1.0/tan(degree) - ( pi/2.0-degree ) ) ;
			E = pi*(double)R*(double)R - pi*r*r*(double)N - I ;
		}

		printf( "%.10f %.10f %.10f\n" , r , I , E ) ;
	}

	return 0 ;
}

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