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

找到错误了

Posted by chengmingvictor at 2005-08-08 22:06:51 on Problem 1067
In Reply To:Re:按照这个BBS上的公式写的,怎么还出错 Posted by:chengmingvictor at 2005-08-08 22:05:48
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	double alpha = (1.0 + sqrt(5.0)) / 2.0;
	double beta  = (3.0 + sqrt(5.0)) / 2.0;
	int big, small, n, temp1, temp2;
	while(cin>>big>>small)
	{
		if(big < small)
			swap(big, small);
		n = ceil(big / beta);
		temp1 = alpha * n;
		temp2 = beta  * n;
		if(small == temp1 && big == temp2)
			cout<<0<<endl;
		else cout<<1<<endl;
	}
	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