Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:1027哪错了,Help me!!!!

Posted by lujiangtao198818 at 2008-05-06 13:05:32
In Reply To:1027哪错了,Help me!!!! Posted by:90405137 at 2004-12-05 19:38:41
> #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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator