Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Output Limit Exceeded?为什么?

Posted by scuttemp at 2009-03-30 20:43:53 on Problem 1207
#include<stdio.h>

int main()
{
	int x , y;
	int max  , temp;
	while ( scanf("%d%d",&x,&y) )
	{
		max = 1 ;
		printf("%d %d " , x , y );

		if ( x > y )
		{
			temp = y ;
			y = x ; 
			x = temp ;
		}

		for ( int j = x; j <= y ; ++ j )
		{
			temp = 1 ;
			int i = j;

			while ( i != 1 )
			{
				if ( i % 2 )
					i = 3 * i + 1 ;
				else 
					i = i / 2 ;
				++ temp;
			}
			if ( temp > max )
				max = temp;
		}

		printf("%d\n",max);

	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator