Follows 10018.c (Total 37 lines):

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

unsigned int reverse( unsigned int m )
{
	unsigned int tmp=0 ;

	while( m ){
		tmp *= 10 ;
		tmp += m%10 ;
		m /= 10 ;
	}

	return tmp ;
}
int main( void )
{
	unsigned int n , m , tmp , time ;
	
	scanf( "%u" , &n ) ;
	for( ; n ; n-- ){
		scanf( "%u" , &m ) ;
		
		for( time=0 ; ; time++ ){
			tmp = reverse( m ) ;
			if( m==tmp && time!=0 ){ /*damn it re-judge ~_~*/
				printf( "%u %u\n" , time , m ) ;
				break ;
			}
			m += tmp ;
		}
	}

	return 0 ;
}
/* @END_OF_SOURCE_CODE */

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