Follows 10190.c (Total 38 lines):

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

int array[100] ;
int n , m , point ;

int ToDo( void )
{
	if( !n || !m || n<m ) return 0 ;

	array[0] = n ;
	for( point=1 ; ; ){
		if( n%m ) return 0 ;
		if( n/m>=array[point-1] ) return 0 ;
		
		array[point++] = n/m ;
		n /= m ;

		if( n==1 ) break ;
	}

	return 1 ;
}
int main( void )
{
	int i ;
	
	for( ; scanf( "%d %d" , &n , &m )==2 ; putchar( '\n' ) )
		if( ToDo() )
			for( i=0 ; i<point ; ++i )
				if( i ) printf( " %d" , array[i] ) ;
				else printf( "%d" , array[i] ) ;
		else printf( "Boring!" ) ;
	
	return 0 ;
}
/* @END_OF_SOURCE_CODE */

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