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:help!!!帮忙看看。为什么运行不了,:)

Posted by gxiverson at 2004-12-22 09:41:30 on Problem 1207
In Reply To:help!!!帮忙看看。为什么运行不了,:) Posted by:gxiverson at 2004-12-22 09:41:16
#include <iostream.h>
void main() {
	int a,b,i,sum=1,o,max=1,x=1,m,n;
	while(x!=2){
	max=1;
	cin>>a>>b;
	m=a;n=b;
	if(a>b){o=a;a=b;b=o;}
	for(i=a;i<=b;i++)
	{
		sum=1;
		while(i!=1)
		{
		 if(i%2==0){i=i/2;sum++;}
	     else if(i%2==1){i=3*i+1;sum++;}
		}                
	if(sum>max){max=sum;}
	}
	cout<<m<<" "<<n<<" "<<max<<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