Follows 674.c (Total 22 lines):

/* @JUDGE_ID:4461XX 674 C */
/* A */
#include<stdio.h>
unsigned long coin_arr[7500] ;
void makeCoinArr( void )
{
	/* 1 , 5 , 10 , 25 , 50 cents*/
	int i , j , k , value[5]={ 1 , 5 , 10 , 25 , 50 } ;
	for( i=0 ; i<7500 ; i++ ) coin_arr[i] = 1 ; /* 1 */
	for( j=1 ; j<5 ; j++ )
		for( i=1 ; i<7500 ; i++ )
			if( i>=value[j] )
				coin_arr[i] += coin_arr[ i-value[j] ] ;
}
void main( void )
{
	int n ;
	makeCoinArr() ;
	while( scanf( "%d" , &n ) == 1 )
		printf( "%lu\n" , coin_arr[n] ) ;
}
/* @END_OF_SOURCE_CODE */

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