Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
帮看看撒wrong answer#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator