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:帮忙看看为什么总是Output Limit Exceed吧In Reply To:帮忙看看为什么总是Output Limit Exceed吧 Posted by:90303125 at 2004-01-03 11:19:12 > #include <iostream.h> > #include <math.h> > int max(long a,long b){ > long c; > if (a<b) > c=b; > else c=a; > return c; > } > int min(long a,long b){ > long c; > if (a<b) > c=a; > else c=b; > return c; > } > void main(){ > long i,j,a,b,n,m; > while (1) > {cin>>i>>j; > if (i<=0||j<=0||i>=10000||j>=10000) break; > m=0; > for (a=min(i,j); a<=max(i,j); a++){ > n=0; > b=a; > while (1) > { n=n+1; > if (b==1) break; > if (b%2==1) b=3*b+1; > else b=b/2; > } > m=max(m,n); > } > cout<<i<<" "<<j<<" "<<m<<endl; > } > } > 谢谢,到底什么意思啊? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator