#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #include "dump.hpp" #else #define dump(...) #endif #define int long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(c) begin(c),end(c) const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f; const int MOD = (int)(1e9) + 7; template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define double long double const double EPS = 1e-8; // 二次方程式を解の公式を用いて解く // 計算量: O(sqrt()の計算量) // 重解は1つにせず返す 1つにしたいなら変えること // Verified: // https://www.urionlinejudge.com.br/judge/en/runs/code/13486899 // http://codeforces.com/contest/233/submission/52143945 vector quadraticEquation(double a, double b, double c) { // 1次方程式 if (abs(a) < EPS) return abs(b) < EPS ? vector() : vector{ -c / b }; // 判別式 double D = b * b - 4 * a*c; // 解無し if (D < -EPS) return vector(); // 重解 if (D < EPS) return vector{-b / (2 * a), -b / (2 * a)}; double d = sqrt(D); double x1 = (-b + d) / (2 * a); double x2 = (-b - d) / (2 * a); if (x1 > x2)swap(x1, x2); return vector{x1, x2}; } // 二分法 // 方程式の求根アルゴリズム // f(l) < 0 かつ 0 < f(r) の場合に限る double bisectionMethod(double l, double r, function f) { double yl = f(l), yr = f(r); if (yl > yr)swap(l, r); assert((yl - EPS) * (yr + EPS) <= 0); for (int i = 0; i < 200; i++) { double m = (l + r) / 2; if (f(m) > 0) r = m; else l = m; } return l; } // 三次方程式 // 二分法でまず1つの解pを求める // a(x-p)(x^2+sx+t) と式変形して二次方程式で残りの解を求める vector cubicEquation(double a, double b, double c, double d) { if (abs(a) < EPS) return quadraticEquation(b, c, d); double p = bisectionMethod(-INF, INF, [&](double x) {return a * x*x*x + b * x*x + c * x + d; }); double t = -d / a / p, s = (c / a - t) / (-p); auto ret = quadraticEquation(1, s, t); ret.push_back(p); sort(ret.begin(), ret.end()); return ret; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int a, b, c; cin >> a >> b >> c; auto w = cubicEquation(1, a, b, c); sort(all(w)); vector v; rep(i, -1, 2) { rep(j, 0, 3) { int x = w[j] + i; if (x*x*x + a * x*x + b * x + c == 0) v.push_back(x); } } sort(all(v)); v.erase(unique(v.begin(), v.end()), v.end()); cout << v[0]; rep(i, 1, v.size()) { cout << " " << v[i]; } cout << endl; return 0; }