| ||||||||||
| 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 | |||||||||
1027哪错了,Help me!!!!#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