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

Re:麻烦大家帮忙看一下吧 !陷阱我避免了 呀,就是不对!!!

Posted by zjp at 2009-02-27 14:19:58 on Problem 1207
In Reply To:麻烦大家帮忙看一下吧 !陷阱我避免了 呀,就是不对!!! Posted by:zjp at 2009-02-27 14:19:22
> #include <stdio.h>
> void main()
> {
> 	int a,b,i,max,k,d,c,m;
> 	while
> 	(EOF!=scanf ("%d %d",&a,&b))
> 	
> 	{       c=a;
> 	        d=b;
> 		
> 		if (a>b)
>         {
> 		 m=a;
> 		 b=m;
> 		 a=b;
> 		}
>     else        
>         max=0;
> 	while (a<=b)
> 	{
> 		i=a;
> 		a++;
> 		k=1;
> 		while (i!=1)
> 		{
> 			if (i%2==0)
> 				i=i/2;
> 			else
> 				i=3*i+1;
> 			k++;
> 		};
> 		if(k>max)
> 			max=k;
> 
> 	}
> 	printf ("%d %d %d\n",c,d,max);
> 	}
> 
> }

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