// yukicoder: No.550 夏休みの思い出(1) // 2019.7.16 bal4u #include #include #include typedef long long ll; #define ABS(x) ((x)>=0?(x):-(x)) int x[3]; int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; } // X^2 + BX + C = 0 (A=1) int solve(int *x1, int *x2, ll b, ll c) { ll d2, d; d2 = b*b - 4*c; if (d2 < 0) return 0; d = (ll)sqrt((double)d2) - 1; while (d*d != d2) d++; if ((-b + d) & 1) return 0; *x1 = (-b + d) / 2; *x2 = (-b - d) / 2; return 1; } ll A, B, C; int check(ll a) { ll c; if (ABS(a) >= 1000000000) return 0; c = -C/a; if ((B-c) % a) return 0; if (-A-a != (B-c)/a) return 0; if (!solve(x+1, x+2, A+a, c)) return 0; x[0] = a; if ((ll)a*x[1]*x[2] == -C && (ll)a + x[1] + x[2] == -A && (ll)a*x[1] + (ll)x[1]*x[2] + (ll)x[2]*a == B) return 1; return 0; } int main() { scanf("%lld%lld%lld", &A, &B, &C); if (C == 0) x[0] = 0, solve(x+1, x+2, A, B); else { ll c = C; if (c < 0) c = -c; int b = (int)sqrt((double)c); int a = 1; while (a <= b) { if (c % a == 0) { if (check(a)) break; if (check(-a)) break; if (check(c / a)) break; if (check(-c / a)) break; } a++; } } qsort(x, 3, sizeof(int), cmp); printf("%d %d %d\n", x[0], x[1], x[2]); return 0; }