Acm:hdu 2899 Strange fuction Problem Solving report-two points, three points

Source: Internet
Author: User

Strange fuctiontime limit:2000/1000 MS (java/others)    Memory limit:32768/32768 K (java/others) total submission (s): 5 933    Accepted Submission (s): 4194Problem Descriptionnow, here is a fuction:  

Three minutes and two points can be, the derivative is monotonous, after the derivation of the second score AC 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 Doubley; One  A DoubleFDoublex) {//derivative -     return  the*pow (x,6)+ -*pow (x,5)+ +*x*x+Ten*x-y;//F (x) = 6 * X^7+8*X^6+7*X^3+5*X^2-Y*X (0 <= x <=100) - } the  - DoubleFDoublex) { -     return 6* POW (x,7)+8*pow (x,6)+7*x*x*x+5*x*x-y*x;//F (x) = 6 * X^7+8*X^6+7*X^3+5*X^2-Y*X (0 <= x <=100) - } +  - intMain () { +     intT; A      while(cin>>T) { at          for(intqq=0; qq<t; qq++) { -Cin>>y; -             if(F (0) >0) { -printf"%.4f\n"F0)); -}Else if(F ( -) <0) { -printf"%.4f\n"F -)); in}Else { -                 DoubleL=0;//0 L R to                 DoubleR= -;//   ------------------------- +                 Doublemid; -                  while(r-l>1e-8) { theMid= (r+l)/2.0; *                     if(f (Mid) >0) { $R=mid;Panax Notoginseng}Else { -L=mid; the                     } +                 } Aprintf"%.4f\n", F (mid)); the             } +         } -     } $     return 0; $}
View Code

Acm:hdu 2899 Strange fuction 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.