Follows 628.c (Total 40 lines):

/* @JUDGE_ID:4461XX 628 C */
/* A */
#include <stdio.h>
#include <string.h>
void main( void )
{
	int i , j , k , strs , times , num , zezos , zezo[9] ;
	char word[100][300] , rule[300] ;
	while( scanf( "%d" , &strs )==1 ){
		printf( "--\n" ) ;
		for( i=0 ; i<strs ; i++ ) scanf( "%s" , word[i] ) ;
		scanf( "%d" , &num ) ;
		for( i=0 ; i<num ; i++ ){
			scanf( "%s" , rule ) ;
			for( j=0 , k=0 ; j<strlen( rule ) ; j++ )
				if( rule[j]=='0' ){
					zezo[k]=0 ;
					k++ ;
				}
			for( times=0 , zezo[k]=1 ; times<strs ; times++ , zezo[k]=1 ){
				for( ; zezo[k]==1 ; ){
					for( j=0 , zezos=k-1 ; j<strlen( rule ) ; j++ ){
						if( rule[j]=='#' ) printf( "%s" , word[times] ) ;
						if( rule[j]=='0' ){
							printf( "%d" , zezo[zezos] ) ;
							zezos-- ;
						}
					}
					putchar( '\n' ) ;
					zezo[0]++ ;
					for( j=0 ; j<k ; j++ )
						if( zezo[j]>=10 ){
							zezo[j+1] += zezo[j] / 10 ;
							zezo[j] = zezo[j] % 10 ;
						}
				}
			}
		}
	}
}

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