Follows 516.c (Total 45 lines):

/* @JUDGE_ID:4461XX 516 C */
/* A */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void check( unsigned long number )
{
	int total , n=0 , i=2 , p[10000] ;
	while( number > 1 )
	{
		total = 0 ;
		while( number%i==0 ) { total++ ; number/=i ; }
		if( total!=0 ) { p[n]=total ; p[n+1]=i ; n+=2 ; }
		i++ ;
	}
	for( i=n-1 ; i>=0 ; i-=2 )
	{
		printf( "%d" , p[i] ) ;
		printf( " %d" , p[i-1] ) ;
		if( i-2>=0 ) printf( " " ) ;
	}
	printf( "\n" ) ;
}
void main( void )
{
	while( 1 )
	{
		char a[100] , *p ; int num[100] , i=1 , j ; unsigned long number=1 ;
		gets( a ) ;
		if( *a=='0' ) break ;

		p = strtok( a , " " ) ;
		num[0] = atoi( p ) ;
		while( 1 )
		{
			p = strtok( NULL , " " ) ;
			if( p==NULL ) break ;
			num[i] = atoi( p ) ;
			i++ ;
		}
		for( j=0 ; j<i ; j+=2 )
		number *= ( unsigned long )pow( num[j] , num[j+1] ) ;
		check( number-1 ) ;
	}
}

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