Follows 10056.c (Total 22 lines):

/* @JUDGE_ID:4461XX 10056 C "MATH" */
/* A */
#include<stdio.h>
#include<math.h>
void main( void )
{
	long N , i ;
	double sum , people , winner , pos /*posibility*/;
	scanf( "%ld" , &N ) ;
	for( ; N ; N-- ){
		scanf( "%lf %lf %lf" , &people , &pos , &winner ) ;
		if( pos==0.0 ) sum=0.0 ;
		else{
			sum = 1.0 / ( 1.0 - pow( 1.0-pos , people ) ) ;
			sum *= pos ;
			for( i=1 ; i<winner ; i++ ) sum *= ( 1.0 - pos ) ;
		}
		printf( "%.4lf\n" , sum ) ;
	}
}
/* @END_OF_SOURCE_CODE */


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