| ||||||||||
| 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:该怎么改呀,晕死了!!!!!In Reply To:该怎么改呀,晕死了!!!!! Posted by:00430030 at 2005-01-11 17:48:44 > #include<stdio.h>
> #include<math.h>
> int f(int n)
> {
> int p;
> for(p=1;n!=1;p++)
> {
> if(n%2) n=3*n+1;
> else n=n/2;
> }
> return p;
> }
> void main ()
> {
> int x,y,i,max;
> for(;;)
> { scanf("%d %d",&x,&y);
>
> max=f(x);
> for(i=x;i<=y;i++)
> if(max<f(i)) max=f(i);
> printf("%d %d %d\n",x,y,max);
> }
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator