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:WA...求大牛神解。

Posted by zsb520 at 2010-09-15 10:50:52 on Problem 1207
In Reply To:WA...求大牛神解。 Posted by:happy__ting at 2010-05-08 22:05:05
> #include<stdio.h>
> #include<math.h>
> #include<string.h>
> #include<stdlib.h>
> int main()
> {
> 	int i,a,b,t,n,m,max,count;
> 	while(scanf("%d%d",&a,&b)!=EOF)
> 	{
> 		n=a;
> 		m=b;
> 	if(a>b) t=a,a=b,b=t;
> 	for(i=a;i<=b;i++)
> 	{
> 		t=i;
> 		for(count=1;t>1;count++)
> 		{
> 			if(t%2==0) t/=2;
> 			else t=t*3+1;
> 		}
> 		if(count>max) max=count;
> 	}
> 	printf("%d %d %d\n",n,m,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