解题思路:
注意事项:
好久不见,今天我来实际检验一下这道题的结果
参考代码:
#include <iostream> #include <cmath> using namespace std; int main() { int x,y; double alpha = (1.0 + sqrt(5.0)) / 2.0; double beta = (3.0 + sqrt(5.0)) / 2.0; while (cin>>x>>y) {if (x>y) { int temp = x;x = y;y = temp; } int n = ceil(y / beta); int x1 = alpha * n; int y1 = beta * n; if (x == x1 && y == y1) cout<<0<<endl; else cout<<1<<endl;} return 0; } 不解释了,今天我实在是太累了!!!!
0.0分
43 人评分