Follows 326.c (Total 19 lines):

/* @JUDGE_ID:4461XX 326 C */
/* A */
#include<stdio.h>
void main( void )
{
	long n , i , j , k , num , arr[10][10] , ans[2][10] ;
	while( scanf( "%ld" , &n ) ){
		if( !n ) break ;
		for( i=0 ; i<n ; i++ ) scanf( "%ld" , &arr[0][i] ) ;
		for( i=1 ; i<n ; i++ )
			for( j=0 ; j<n-i ; j++ ) arr[i][j] = arr[i-1][j+1] - arr[i-1][j] ;
		for( i=0 , j=n-1 ; i<n ; i++ , j-- ) ans[0][i] = arr[j][i] ;
		scanf( "%ld" , &num ) ;
		for( i=1 , j=0 , ans[1][0]=ans[0][0] ; j<num ; i = !i , j++ )
			for( k=1 ; k<n ; k++ )
				ans[i][k] = ans[!i][k] + ans[i][k-1] ;
		printf( "Term %ld of the sequence is %ld\n" , num+n , ans[!i][n-1] ) ;
	}
}

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