Pay attention to the accuracy of this question. At that time, it is a simple binary enumeration. [Cpp] # include <iostream> # include <cstdio> # include <cmath> using namespace std; const double eps = 1e-4; double f (double x) {double X [4] = {x}; for (int I = 1; I <4; I ++) X [I] = x * X [I-1]; return 8 * X [3] + 7 * X [2] + 2 * X [1] + 3 * X [0] + 6;} int main () {double x, y, result; _ int64 low, mid, up; int t; scanf ("% d", & t); while (t --) {scanf ("% lf ", & y); if (y <6) {printf ("No solution! \ N "); continue;} // set up to 1000000 at the beginning. The precision is not enough. At last, I am entangled in low = 0; up = 100000000000000; while (low <= up) {mid = (low + up)/2; x = mid/1000000000000.0; result = f (x); if (fabs (result-y) <eps) break; if (result <y) low = mid + 1; else up = mid-1;} if (low <= up) printf ("%. 4lf \ n ", x); else printf (" No solution! \ N ") ;}return 0 ;}