It is actually a simple mathematical extreme problem.
Everyone will know after reading the code.
Originally, I wanted to study binary search, but I found that there are not many specialized binary search methods. It is just an idea and a tool.
Paste the Code:
# Include <stdio. h> # include <string. h> # include <stdlib. h> # include <math. h> const double EPS = 1e-8; int y; double G (Double X) {return 42 * POW (x, 6) + 48 * POW (x, 5) + 21 * POW (x, 2) + 10 * X;} double F (Double X) {return 6 * POW (x, 7) + 8 * POW (x, 6) + 7 * POW (x, 3) + 5 * POW (x, 2)-x * Y;} int main () {int t; scanf ("% d ", & T); While (t --) {scanf ("% d", & Y); If (G (100.0)-Y <= 0) printf ("%. 4lf \ n ", F (100.0); else {double L = 0, r = 100; double mid; while (L + EPS <= r) {mid = (L + r)/2; If (G (MID)-Y <0) L = mid; elser = mid;} printf ("%. 4lf \ n ", F (MID) ;}} return 0 ;}