Solving equation of 0-point solution of monotone function by poj1905--dichotomy method

Source: Internet
Author: User
Tags in degrees

poj1905--two-part method for solving the 0-point solution equation of monotone function expanding rods
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 12773 Accepted: 3291


When a thin rod of length l was heated n degrees, it expands to a new length L ' = (1+n*c) *l, where C was the coefficient of he At expansion.
When a thin rod was mounted on both solid walls and then heated, it expands and takes the shape of a circular segment, the O Riginal Rod being the chord of the segment.

Your task is to compute the distance by which the center of the rod is displaced.


The input contains multiple lines. Each line of input contains three non-negative numbers:the initial lenth of the rod in millimeters, the temperature Chang E in degrees and the coefficient of heat expansion of the material. Input Data Guarantee This no rod expands by more than one half of its original length. The last line of input contains three negative numbers and it should isn't be processed.


For each line of input, output one line with the displacement of the center of the rod in millimeters with 3 digits of pre Cision.

Sample Input

1000 100 0.000115000 10 0.0000610 0 0.001-1-1-1

Sample Output

Test instructions: The length of the iron plate, the increase of temperature C will have a certain degree of deformation, the length of the NEWL, arc-shaped, to find the height of the midpoint deviation of the iron plate
Ideas: Mathematical problems, the solution of the equation when the structure of the two-time derivation of the change trend, two points to determine the 0-point range, miss the exam before the test to brush math paper derivative problem time. This problem requires attention to accuracy and 0 of the data.
/** Start at 12:53 * End at 13:08 * problem:poj1905 * Author: __560*/#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>#include<math.h>using namespacestd;Const intmaxn=1000100; Const intInf= (1<< -); Const DoublePi=3.1415927; Const Doubleexp=0.000000000001; Doublel,t,c;Doublenewl;DoubleFDoublex) {returnl*x-newl*sin (x);} DoubleBinsearch (DoubleLeftDoubleRight ) {      while(Fabs (Left-right) >Exp) {        DoubleMid= (left+right)/2; if(f (Mid) <0) left=mid; Else if(mid>0) right=mid; }     returnLeft ;} intMain () { while(SCANF ("%LF%LF%LF", &l,&t,&c)! =EOF) {        if(l==-1&&t==-1&&c==-1)return 0; if(l==0|| t==0|| c==0) puts ("0.000"); Else{NEWL=(1+C*T) *m; Doublex=Binsearch (EXP,PI); Doubler=newl/(2*x); DoubleD=SQRT (r*r-l*l/4); printf ("%.3f\n", R-d); }     } }
View Code

Solving equation of 0-point solution of monotone function by poj1905--dichotomy method

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: 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.