| ||||||||||
| 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:1027哪错了,Help me!!!!In Reply To:1027哪错了,Help me!!!! Posted by:90405137 at 2004-12-05 19:38:41 > #include <stdio.h>
> #include <math.h.>
> int f(int n)
> { int i;
> for(;;i++)
> {
> if(n==1) break;
> else if(n%2) n=3*n+1;
> else n=n/2;
> }
> return i++;}
> void main ()
> {
> int j;
> for(j=1;j<=10000;j++)
> {
> int a,b,max,i,c[10000];
> scanf("%d %d",&a,&b);
> for(i=0;i<b-a;i++)
> c[i]=a+i;
> max=0;
> for(i=0;i<b-a;i++)
> if(max<f(c[i]))
> max=f(c[i]);
> printf("%d %d %d\n",a,b,max);
> }
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator