#include #include #define int long long using namespace std; class Long { public: int v[256]; //256桁, 冗長だけど2進数で, v[255]…MSB. 最上位ビットは補数表現 (v[0]は小数点に使う) Long (double _x) { int x = _x * 2; bool flag = false; if (x < 0) { x = -x; flag = true; } for (int i = 0; i < 64; i++) { v[i] = (x >> i) % 2; } for (int i = 64; i < 256; i++) { v[i] = 0; } if (flag) { (*this) = hosuu(); } } Long hosuu() { Long ret(256); for (int i = 0; i < 256; i++) { ret.v[i] = !v[i]; } ret.v[0]++; for (int i = 0; i < 255 && ret.v[i] == 2; i++) { ret.v[i + 1]++; ret.v[i] = 0; } ret.v[255] %= 2; return ret; } Long operator+(Long l) { Long ret(0); for (int i = 0; i < 256; i++) { ret.v[i] = v[i] + l.v[i]; } for (int i = 0; i < 255; i++) { ret.v[i + 1] += ret.v[i] / 2; ret.v[i] %= 2; } ret.v[255] %= 2; return ret; } Long operator*(Long l) { Long ret(0); Long a = (*this); Long b = l; bool flag = false; if (isMinus()) { flag = !flag; a = a.hosuu(); } if (l.isMinus()) { flag = !flag; b = b.hosuu(); } for (int i = 0; i < 256; i++) { if (!b.v[i]) continue; for (int j = 0; j < 256; j++) { if (i + j >= 256) break; ret.v[i + j] += a.v[j]; } } for (int i = 0; i < 255; i++) { ret.v[i + 1] += ret.v[i] / 2; ret.v[i] %= 2; } ret.v[255] = 0; //右シフトする for (int i = 1; i < 256; i++) { ret.v[i - 1] = ret.v[i]; } if (flag) { ret = ret.hosuu(); } return ret; } bool isMinus() { return (v[255] == 1); } void print() { cout << "value = "; for (int i = 255; i > 0; i--) { cout << v[i]; } cout << "." << v[0] << endl; } }; int a, b, c; int keisu[4]; bool isMinus(double x) { Long _x(x); Long y(0); Long k[4] = {keisu[0], keisu[1], keisu[2], keisu[3]}; y = y + k[3] * (_x * _x * _x); y = y + k[2] * (_x * _x); y = y + k[1] * _x; y = y + k[0]; return y.isMinus(); } int search(int jisuu) { int st, ed, mid; //(st, ed], -----++++ if (jisuu == 3) { st = -1e+9; ed = 1e+9; } if (jisuu == 2) { double x = -keisu[1] / (2 * keisu[2]); if (isMinus(x)) { st = x; ed = 1e+9; } else { ed = x; st = -1e+9; } } if (jisuu == 1) { return -keisu[0] / keisu[1]; } while (ed - st >= 2) { mid = (st + ed) / 2; if (isMinus(mid)) { st = mid; } else { ed = mid; } } return ed; } void divide(int kai) { int syo[4] = {0}; for (int i = 3; i > 0; i--) { syo[i - 1] = keisu[i]; keisu[i - 1] += kai * keisu[i]; keisu[i] = 0; } for (int i = 0; i < 4; i++) { keisu[i] = syo[i]; } } signed main() { cin >> a >> b >> c; keisu[3] = 1; keisu[2] = a; keisu[1] = b; keisu[0] = c; int ans[3]; for (int i = 0; i < 3; i++) { int kai = search(3 - i); divide(kai); ans[i] = kai; } sort(ans, ans + 3); for (int i = 0; i < 3; i++) { cout << ans[i]; if (i + 1 < 3) cout << " "; } cout << endl; return 0; }