No.1381 Simple Geometry 1
Problem Statement
In this problem, $\ |AB|\ $ denotes the length of the segment $\ AB\ $ that has points $\ A\ $ and $\ B\ $ as its endpoints and connects these $\ 2\ $ points.
On a two-dimensional plane, there is a rectangle $\ ABCD\ $, with a point $\ P\ $ on side $\ AD\ $ and a point $\ Q\ $ on side $\ CD\ $.
They also satisfy the following.
- The area of rectangle $\ ABCD\ $ is $\ X\ $
- Points $\ P\ $ and $\ Q\ $ are not at the same position
- $|BP|=|BQ|+W$
- $|AP|=Y$
- $|CQ|=Z$
Find the area of triangle $\ BPQ\ $.
Input
$X\ \ Y\ \ Z\ \ W$
- $1 \leq Y \times Z < X \leq 10^6$
- $1 \leq Y,Z$
- $0 \leq W \leq 10^6$
- All inputs are integers
- There exist a rectangle $\ ABCD,\ $ a point $\ P,\ $ and a point $\ Q\ $ satisfying the conditions
Output
Output the area of triangle $\ BPQ\ $, followed by a newline.
Your answer is considered correct if its relative or absolute error from the expected solution is at most $\ 10^{-5}\ $.
Sample
Sample 1
Input
96 5 6 3
Output
33.0000000000
When rectangle $\ ABCD\ $ satisfies $\ |AB|=12,|AD|=8\ $, we have $\ |BP|=13,|BQ|=10\ $, which satisfies the conditions.
Sample 2
Input
16 2 2 0
Output
6.0000000000
When rectangle $\ ABCD\ $ satisfies $\ |AB|=4,|AD|=4\ $, we have $\ |BP|=2\sqrt{5},|BQ|=2\sqrt{5}\ $, which satisfies the conditions.
Note that $\ |AB|=|AD|\ $ is possible.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
蜜蜂