Can you solve this equation?
Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 4834 accepted submission (s): 2259
Problem descriptionnow, given the equation 8 * x ^ 4 + 7 * x ^ 3 + 2 * x ^ 2 + 3 * x + 6 = Y, can you find its solution between 0 and 100;
Now please try your lucky.
Inputthe first line of the input contains an integer T (1 <= T <= 100) which means the number of test cases. then T lines follow, each line has a real number y (FABS (y) <= 1e10 );
Outputfor each test case, You shocould just output one real number (accurate up to 4 decimal places), which is the solution of the equation, or "no solution !", If there is no solution for the equation between 0 and 100.
Sample Input
2100-4
Sample output
1.6152no solution!
Authorredow
Recommendlcy is a complex question. After the derivation, it is obvious that the derivative is greater than 0 under the condition. There is only one point of intersection between the increase in this interval and the X axis .. Directly judge the value of Y. In binary mode.
# Include <stdio. h> double y = 0; double F (Double X) {return 8 * x + 7 * x + 2 * x + 3 * x + 6-y;} int main () {int t; double bop, top, mid, M; M = f (100); scanf ("% d", & T); While (t --) {scanf ("% lf", & Y); If (Y <6 | Y> m) // printf ("no solution! \ N "); else {BOP = 0; Top = 100; while (top-bop> 1e-8) {mid = (top + BOP)/2; If (f (MID) * F (top) <0) BOP = mid; else Top = mid;} printf ("%. 4lf \ n ", mid) ;}} return 0 ;}