| ||||||||||
| 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 | |||||||||
为什么一直都是 wrong answer?? 1207 有大牛能帮我看一下吗?#include <stdio.h>
int main()
{ int x[10],y[10],i,mark[10],max[10],n=0,z;
for (i=0;i<10;i++)
{ x[i]=0;
y[i]=0;
mark[i]=0;
max[i]=0;
}
for(n=0;scanf("%d %d",&x[n],&y[n])!=EOF;n++)
{
for (i=x[n];i<=y[n];i++)
{z=i;
mark[n]=0;
while(z!=1)
{if ((float) z/2!=z/2) z=3*z+1;
else z=z/2;
mark[n]++;
}
if (max[n]<mark[n]+1) max[n]=mark[n]+1;
}
}
for(i=0;i<=n-1;i++)
{printf("%d %d %d\n",x[i],y[i],max[i]);
}
return(0);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator