Follows 100.c (Total 28 lines):

/* @JUDGE_ID:4461XX 100 C */
/* A */
#include <stdio.h>
long from , to , waited , i , j , cycle=0 , big=0 ;
void main( void )
{
	while( scanf( "%ld %ld" , &from , &to )==2 )
	{
		printf( "%ld %ld" , from , to ) ;
		if( from>to ){
			waited = from ;
			from = to ;
			to = waited ;
		}
		big = 0 ;
		for( i=from ; i<=to ; i++ ){
			cycle = 1 ;
			j = i ;
			while( j!=1 ){
				if( j%2==1 ) j = 3 * j + 1 ;
				else j = j / 2 ;
				cycle++ ;
			}
			if( cycle>=big) big = cycle ;
		}
		printf( " %ld\n" , big ) ;
	}
}

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