| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
找到错误了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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator