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 luyao1103 at 2010-10-22 14:23:43 on Problem 1067
In Reply To:超时,我无语,求牛人解释,是不是输入输出控制上的问题,诚谢! Posted by:scuwf at 2010-10-17 09:47:54
#include<stdio.h>
#include<math.h>
int main (void)
{
	long int a,b,r,temp;
	while(scanf("%ld%ld",&a,&b)!=EOF)//增加结束条件
	{
		r=abs(a-b);
		if(a>b)
		{
			temp=b;
		}
		else
		{
			temp=a;
		}
		if(r>=2*temp/(sqrt(5.0)+1) && r<2*(temp+1)/(sqrt(5.0)+1))
		{
			printf("0\n");
		}
		else
		{
			printf("1\n");
		}
	}
	return 0;
}
修改成这样就可以了。

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