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 shipengbo2006 at 2007-10-03 23:04:50 on Problem 1207
#include <iostream.h>
int f(int t)
{
	int count=1;
lable:if(t==1)
		  return count;
	  if(t%2!=0)
		  t=3*t+1;
	  else
		  t=t/2;	
	  count++;
	  goto lable;
}
void main(void)
{
	int a1,a2,s1,s2,min,max,temp;
	while(cin>>a1>>a2)
	{
		max=(a1>a2?a1:a2);
		min=a1+a2-max;
		s1=f(min);
		s2=f(min+1);
		temp=(s1>s2?s1:s2);
		while(min+2<max)
		{
			min++;
			if(temp<f(min+1)) temp=f(min+1);
		}
		cout<<a1<<" "<<a2<<" "<<temp<<endl;
	}
}

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