Can You Solve ThisEquation?Time Limit: -/ +MS (java/others) Memory Limit:32768/32768K (java/Others) Total submission (s):16281Accepted Submission (s):7206problem Descriptionnow,given the equation8*x^4+7*x^3+2*x^2+3*x +6= = Y,can you find its solution between0and -; nowTryyour lucky. Inputthe first line of the input contains an integer T (1<=t<= -) 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 should just output one real number (accurate4 decimalPlaces), which isThe solution of the Equation,or "No solution!",ifThere isNo solution forThe equation between0and -. Sample Input2 --4Sample Output1.6152No Solution!Authorredow Recommendlcy
Math problem, direct binary, code
1#include"iostream"2#include"algorithm"3#include"Cstdio"4#include"CString"5#include"Cmath"6 #defineMax (A, b) a>b?a:b7 #defineMin (A, b) a<b?a:b8 #defineMX 10000 + 509 using namespacestd;Ten One DoubleFDoublex) A { - return 8*pow (x,4)+7*pow (x,3)+2*pow (x,2)+3*x+6; - } the - intMain () - { - intN; + Doublem; - while(~SCANF ("%d",&N)) + { A for(intk=1; k<=n; k++) at { -scanf"%LF",&m); - - DoubleI=0.0; - if(M<f (0)|| M>f ( -)) - { inprintf"No solution!\n");Continue; - } to DoubleFr=0.0, ed=100.0; + for(; Fabs (F (FR)-F (ed)) >1e-4;) - { theI= (fr+ed)/2; * if(f (i) <m) fr=i; $ ElseEd=i;Panax Notoginseng } - { theprintf"%.4lf\n", i); + } A } the } + return 0; -}
View Code
Acm:hdu 2199 Can You solve this equation? Problem solving report-two points, three points