2022/7/21
作者:
史一帆
,
2022-07-21 08:50:33
,
所有人可见
,
阅读 169
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <set>
#include <string>
#include <unordered_map>
using namespace std;
const int N = 10010;
typedef long long LL;
int a, b;
int main(){
while (cin >> a >> b){
double w = (sqrt(5) + 1) / 2;
if (int(abs(a - b) * w) == min(a,b))
cout << 0;
else cout << 1;
cout << endl;
}
return 0;
}
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <set>
#include <string>
#include <unordered_map>
using namespace std;
typedef long long LL;
const LL mo = 1e9;
LL a, b;
LL tmp[3] = {618033988, 749894848, 204586834};
int main(){
int T;
cin >> T;
while (T -- ){
cin >> a >> b;
if (b < a) swap(a, b);
LL cha = b - a;
LL p = cha / mo, q = cha % mo;
LL ans = q * tmp[2];
ans = p * tmp[2] + q * tmp[1] + ans / mo;
ans = p * tmp[1] + q * tmp[0] + ans / mo;
ans = cha + p * tmp[0] + ans / mo;
if (ans == a)
puts("B");
else
puts("A");
}
return 0;
}
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <set>
#include <string>
#include <unordered_map>
using namespace std;
typedef long long LL;
int a, b;
int main(){
while (cin >> a >> b){
if (!a && !b) break;
double k = (sqrt(5) + 1) / 2;
if (int((b - a) * k) == a) cout << 0 << endl;
else{
cout << 1 << endl;
int ans = (b - a) * k;
cout << ans << ' ' << ans + b - a << endl;
ans = (sqrt(5) - 1) / 2 * a;
cout << ans << ' ' << a << endl;
}
}
return 0;
}