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

高手帮我看一下我哪里错了呢

Posted by bike at 2009-07-15 17:27:41 on Problem 1207
#include <stdio.h>
int main(int argc, char *argv[])
{   
    int m,n,a,count=0,max,k,l,t;
	while(scanf("%d%d",&m,&n)!=EOF)
	{     
	      k=m;
		  l=n;	
	      max=0;
	      if(m>n)
	      {
	       t=m;
	       m=n;
	       n=t;
	      }
	      
	    for(a=m;a<n;a++)
		{   
		   while(a!=1)
		   {
			if(a%2==0)
			{
			a=a/2;
			count++;
			}
			else
			{
			a=3*a+1;
			count++;
			}
		   }
		   if(count>max)
			max=count;
		   
		}
			printf("%d %d %d",k,l,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