Acm:hdu 2199 Can You solve this equation? Problem solving report-two points, three points

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.