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

为什么我还是wa呢???哪位帮我看看????即使是去掉!EOF,为什么会是TLE呢??

Posted by 766826825 at 2010-08-22 20:38:56 on Problem 1207
#include<stdio.h>
int jud(int n)
{
	int i=1;
	while(n!=1)
	{
		if(n%2==0)
			n=n/2;
		else 
			n=3*n+1;
		i++;
	}
	return i;
	
}
int main()
{
	int i;
	int m,n,t;
	
	while(scanf("%ld %ld",&m,&n)!=EOF)
	{
		if(m>n)
		{
			for(i=n;i<=m;i++)
			{
				if(jud(i)>t)
					t=jud(i);
			}
		}
		for(i=m;i<=n;i++)
		{
			if(jud(i)>t)
				t=jud(i);
		}
		
		printf("%d %d %d\n",m,n,t);
		t=0;
	}
	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