Expanding Rods
Time limit1sMemory limit128 MB
Given a heated rod fixed at both ends, compute how far its midpoint bows out, using the circular-segment geometry and binary search.
- Level
Medium6 of 10
- Topics
- Binary search, Geometry, Math
- Solved
- No attempts yet
Problem
When a thin rod of length is heated by degrees, it expands to a new length , where is the coefficient of thermal expansion.
When such a rod is fixed between two solid walls and then heated, it expands and bows into the shape of a circular segment, with the original straight rod becoming the chord of that segment.
Your task is to compute the distance by which the center of the rod is displaced.
Input
The input consists of several lines. Each line contains three non-negative numbers: the initial length of the rod in millimeters, the temperature change in degrees, and the coefficient of thermal expansion of the material. It is guaranteed that no rod expands by more than one half of its original length. The last line contains three negative numbers and must not be processed.
Output
For each line of input, print a single line containing the displacement of the center of the rod in millimeters, rounded to 3 decimal places.