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:该怎么改呀,晕死了!!!!!

Posted by 90401103 at 2005-01-11 18:34:21 on Problem 1207
In Reply To:该怎么改呀,晕死了!!!!! Posted by:00430030 at 2005-01-11 17:48:44
> #include<stdio.h>
> #include<math.h>
> int f(int n)
> {
> 	int p;
> 	for(p=1;n!=1;p++)
> 	{
> 		if(n%2)  n=3*n+1;
> 		else     n=n/2;
> 	}
> 	return p;
> }
> void main ()
> {
> 	int x,y,i,max;
> 	for(;;)
> {	scanf("%d %d",&x,&y);
> 	
> 	max=f(x);
> 	for(i=x;i<=y;i++)
> 		if(max<f(i))  max=f(i);
> 		printf("%d %d %d\n",x,y,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