# Zoj 3203 light bulb (three-part algorithm)

Source: Internet
Author: User
Tags bitset cmath

/* Move people around and find the longest length of the Shadow L.
According to the figure, it is easy to find that when the light, the person's head and the corner are in a straight line (assuming that the person is standing at a point), the length at this time is the maximum length of the shadow on the ground. When a person goes to the right, the shadow begins to be projected onto the wall. When a person sticks to the wall, the length of the shadow is the height of the person. So when a person moves from point A to the wall, the function increments first and then decreases, which is a convex function, so we can use the three-way method to solve the problem.
*/

``` # include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include

# include
using namespace STD; const double EPS = 1e-9; int t; double D, H, H; double CAL (Double X) {return D-x + H-(h-h) * D/X;} int main () {int t; double ans; scanf ("% d", & T); While (t --) {scanf ("% lf", & H, & H, & D); double Lp = (h-h) * D/h, Rp = D; while (LP + EPS

= val2) Rp = mid2; else Lp = mid1; ans = val1 ;} printf ("%. 3lf \ n ", ANS);} return 0 ;}

```

Related Keywords:

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.