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:帮忙看看为什么总是Output Limit Exceed吧

Posted by blackmoon at 2006-05-04 13:52:11 on Problem 1207
In Reply To:帮忙看看为什么总是Output Limit Exceed吧 Posted by:90303125 at 2004-01-03 11:19:12
> #include <iostream.h>
> #include <math.h>
> int max(long a,long b){
> 	long c;
> 	if (a<b)
> 	    c=b;
> 	else c=a;
> 	return c;
> }
> int min(long a,long b){
> 	long c;
> 	if (a<b)
> 		c=a;
> 	else c=b;
> 	return c;
> }
> void main(){
> 	long i,j,a,b,n,m;
> 	while (1)
> 	{cin>>i>>j;
> 	if (i<=0||j<=0||i>=10000||j>=10000) break;
> 	    m=0;
>      for (a=min(i,j); a<=max(i,j); a++){
>       	    n=0;
> 			b=a;
>         while (1)
> 		{ n=n+1;
> 		if (b==1) break; 
> 		if (b%2==1) b=3*b+1;
> 		else b=b/2;
> 		}
>           m=max(m,n);
> 	}
> 	cout<<i<<" "<<j<<" "<<m<<endl;
> 	}
> }
> 谢谢,到底什么意思啊?

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