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 hhxxjieoo at 2019-01-08 15:13:53 on Problem 1207
In Reply To:这样做是好的! Posted by:chenxuan123456789 at 2012-07-31 08:37:23
> #include <stdio.h>
> int main()
> {
> 	int a,b,temp,ka,kb,count,k,m,max;
> 	while(scanf("%d%d",&a,&b)!=EOF)
> 	{
> 		printf("%d %d ",a,b);
> 		if(a>b)
> 		{
> 			temp=a;
> 			a=b;
> 			b=temp;
> 		}
> 		max=0;
> 		for(k=a;k<=b;k++)
> 		{
> 			m=k;
> 			count=1;
> 			while(m!=1)
> 			{
> 				if(m%2)
> 					m=3*m+1;
> 				else
> 					m/=2;
> 				count++;
> 			}
> 			if(count>max)
> 			max=count;
> 		}
> 		printf("%d\n",max);
> 	}
> 	return 1;
> }
> 
> 

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