Follows 834.c (Total 31 lines):

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

void decompose( int up , int down )
{
	int tmp ;

	putchar( '[' ) ;
	printf( "%d;" , up/down ) ;
	tmp = down ;
	down = up%down ;
	up = tmp ;

	while( up%down!=0 ){
		printf( "%d," , up/down ) ;
		tmp = down ;
		down = up%down ;
		up = tmp ;
	}

	printf( "%d]\n" , up/down ) ;
}
int main( void )
{
	int up , down ;

	while( scanf( "%d %d" , &up , &down )==2 )
		decompose( up , down ) ;
	return 0 ;
}

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