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

帮看看撒wrong answer

Posted by iago at 2004-11-15 19:38:30 on Problem 1207
#include<iostream.h>
main()
{
int a,b,max1=1,max2=0,ca=0;
while(cin>>a>>b){
	max1=max2=0;
    if(a>b){int temp=a;a=b;b=temp;}
    if(a>0&&b>0&&b<1000000&&a<1000000);
	else break;
	for(int i=a,ca=a;i<=b;i++){
		while(ca!=1){
			if(ca%2!=0) ca=3*ca+1;
			else ca=ca/2;
			max1++;}
			ca=i+1;
        if(max1>max2) max2=max1;
		max1=1;
	}
cout<<a<<" "<<b<<" "<<max2<<endl;    
}
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