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 |
Re:help!!!帮忙看看。为什么运行不了,:)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator