No.764 Floating Points
Problem Statement
There are 2 fixed points $P_0, \ P_{N+1}$ on a plane, and the distance (Euclidean distance) between $P_0$ and $P_{N+1}$ is $L_0$.
In addition to the 2 fixed points above, there are $N$ moving points $P_1, \ P_2, \ \ldots , \ P_N$ on this plane, which move while satisfying the following.
- The distance between $P_{i-1}$ and $P_i$ is $L_i \ (1 \le i \le N+1)$.
For each of the $N$ moving points $P_1, \ P_2, \ \ldots , \ P_N$, find the area of the region in which it can move.
If the region in which a point can move consists only of points or lines, or if no region satisfying the above condition exists, the area is considered to be $0$.
Also, if the region in which a point can move is divided into 2 or more parts, output the sum of their areas.
Input
$N$
$L_0$
$L_1$
$\ldots$
$L_{N+1}$
The first line contains an integer $N$, the number of moving points.
The i-th $(1 \le i \le N+2)$ of the following $N + 2$ lines contains an integer $L_{i-1}$.
$L_i$ represents
- the distance between $P_0$ and $P_{N+1}$ when $i = 0$;
- the distance between $P_{i-1}$ and $P_i$ when $1 \le i \le N+1$.
The input consists of $N + 3$ lines in total and satisfies the following constraints.
- All input values are integers.
- $3 \le N \le 1000$
- $1 \le L_i \le 1000 \ (0 \le i \le N+1)$
Output
$S_1$ $S_2$ $\ldots$ $S_N$
The expected output consists of $N$ lines.
On the i-th line $(1 \le i \le N)$, output the area of the region in which the moving point $P_i$ can move.
Your answer is considered correct if the absolute or relative error is at most $10^{-6}$.
Print a newline at the end.
Sample
Sample 1
Input
3 8 3 5 3 4
Output
0 58.62347424991461 0
Sample 2
Input
4 16 1 2 3 4 5
Output
0 0 0 0
No points satisfying the conditions exist.
Sample 3
Input
12 10 900 800 700 600 500 400 300 200 100 200 300 400 500
Output
0 9047786.842338604 18095573.68467721 26420794.21669016 18095573.68467721 12566370.61435917 9079202.768874502 7068583.470577035 6157521.601035995 4523893.421169302 2513274.122871834 0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
りあん
37zigen