P8718 [Lanqiao Cup 2020 NOI Qualifier A2] Deserted Island Exploration

Description

Scientist Xiao Lan arrived on a deserted island and planned to explore and survey it. Xiao Lan used an ultrasonic positioning device to locate himself. To use this device, Xiao Lan needs to install a fixed transmitter at one point and a fixed receiver at another point. Xiao Lan also has a mobile device. The positioning process is: the transmitter sends a signal to the mobile device, the mobile device forwards it immediately after receiving it, and finally the receiver receives it. Based on the time differences during transmission, the device can compute the two distances from the mobile device to the transmitter and to the receiver, thus achieving positioning. Xiao Lan has already installed the transmitter and the receiver at two locations: the transmitter is at $\left(x_{A},y_{A}\right)$, and the receiver is at $\left(x_{B},y_{B}\right)$. The transmitter and receiver may be on the island, or they may be outside the island. The positioning device has a design flaw: when the sum of the distance from the transmitter to the mobile device and the distance from the mobile device to the receiver is greater than $L$, the device does not work properly. When the sum is less than or equal to $L$, the device works properly. For safety, Xiao Lan only explores within the region where the device works properly. It is known that the island is a triangle, with vertices at $\left(x_{1}, y_{1}\right)$, $\left(x_{2},y_{2}\right)$, and $\left(x_{3},y_{3}\right)$. Please compute the area on the island that Xiao Lan can explore.

Input Format

The first line contains five integers: $x_{A}$, $y_{A}$, $x_{B}$, $y_{B}$, $L$. The second line contains six integers: $x_{1}$, $y_{1}$, $x_{2}$, $y_{2}$, $x_{3}$, $y_{3}$.

Output Format

Output one line containing one real number, rounded to $2$ decimal places, representing the answer. Considering errors in computation, you will get full score as long as your output differs from the reference output by no more than $0.01$.

Explanation/Hint

**Sample Explanation** The shape of the deserted island and the region where the positioning device works properly are shown in the figure below. The blue triangle represents the island, and the region enclosed by the red curve is the region where the positioning device works properly. ![](https://luogu.oss-cn-hangzhou.aliyuncs.com/upload/vjudge_pic/lanqiao/2022_09_30_7ff7a90fd65c5962b43dg-14.jpg) You can get the score when the output is $39.98$, $39.99$, or $40.00$. **Constraints and Notes** For all test cases, it is guaranteed that the two coordinates of the transmitter are different, $-1000 \leq x_{A}, y_{A}, x_{B}, y_{B} \leq$ $1000,-1000 \leq x_{1}, y_{1}, x_{2}, y_{2}, x_{3}, y_{3} \leq 1000,0 < L \leq 1000$. Lanqiao Cup 2020 Second Round Provincial Contest, Group A, Problem I. Translated by ChatGPT 5