Follows 10105.c (Total 31 lines):

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

int main( void )
{
	int n , k , sum , tmp ;
	int i , j ;
	
	while( scanf( "%d %d" , &n , &k )==2 ){
		sum = 1 ;
		
		for( ; k ; k-- ){
			scanf( "%d" , &tmp ) ;
			for( i=1,j=1 ; j<=tmp ; i++,j++ ){
				sum *= i ;
				sum /= j ;
			}
			for( j=1 ; j<=n-tmp ; i++,j++ ){
				sum *= i ;
				sum /= j ;
			}
			n -= tmp ;
		}

		printf( "%d\n" , sum ) ;
	}
	
	return 0 ;
}
/* @END_OF_SOURCE_CODE */

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