| ||||||||||
| 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 | |||||||||
Output Limit Exceeded?为什么?#include<stdio.h>
int main()
{
int x , y;
int max , temp;
while ( scanf("%d%d",&x,&y) )
{
max = 1 ;
printf("%d %d " , x , y );
if ( x > y )
{
temp = y ;
y = x ;
x = temp ;
}
for ( int j = x; j <= y ; ++ j )
{
temp = 1 ;
int i = j;
while ( i != 1 )
{
if ( i % 2 )
i = 3 * i + 1 ;
else
i = i / 2 ;
++ temp;
}
if ( temp > max )
max = temp;
}
printf("%d\n",max);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator