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啊 兄弟们帮帮小弟看看啊···

Posted by 211006231 at 2011-05-26 13:28:53 on Problem 1207
#include<stdio.h>
int main()
{
	int n,m,t;
	int i,max,k,c1,c2,flag;
	while(scanf("%d %d",&n,&m)!=EOF)
	{c2=0;flag=0;
	if(n>m)
	{
		t=n;n=m;m=t;
		flag=1;
		
	}
		for(i=n;i<m;i++)
		{c1=1;k=i;
			while(k!=1)
			{
				if(k%2==0)
				k=k/2;
				else 
				k=3*k+1;
				c1++;
			}			
			if(c1>c2)
			{
				c2=c1;				
			}
		}		
		
		if(flag==1)
		{
			t=n;n=m;m=t;
		}
			printf("%d %d %d\n",n,m,c2);
		
	}
	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