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

Time Limit Exceeded,求解释

Posted by zhbohao at 2011-11-13 17:52:56 on Problem 1067
#include "stdio.h"
#include "math.h"
void main()
{
    double a,b,temp1,temp2;
    int i;
    while(scanf("%lf %lf",&a,&b)!=EOF)
    {
    	if(a>b)
    	{
    		temp1=a;
    		a=b;
    		b=temp1;
    	}
    	for(i=1,temp1=0,temp2=0;floor(temp1)<a&&floor(temp2)<b;i++)
		{
			temp1=i*(1+sqrt(5))/2;
			temp2=temp1+i;
		}
		printf("%d\n",(floor(temp1)==a&&floor(temp2)==b)?0:1);
	}
}

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