| ||||||||||
| 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:zjp at 2009-02-27 14:19:22 > #include <stdio.h>
> void main()
> {
> int a,b,i,max,k,d,c,m;
> while
> (EOF!=scanf ("%d %d",&a,&b))
>
> { c=a;
> d=b;
>
> if (a>b)
> {
> m=a;
> b=m;
> a=b;
> }
> else
> max=0;
> while (a<=b)
> {
> i=a;
> a++;
> k=1;
> while (i!=1)
> {
> if (i%2==0)
> i=i/2;
> else
> i=3*i+1;
> k++;
> };
> if(k>max)
> max=k;
>
> }
> printf ("%d %d %d\n",c,d,max);
> }
>
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator