KONSTRAKSCHION - Weird Construction
Vieri Corp, a technology company, has requested Bima, a constructor, to build an isosceles triangle on their brand new field. On each vertex of the triangle, they requested a pole A, B and C where AB = BC. It is guaranteed that B is the shortest pole. They also requested a rope of length x and y to connect the tip of the poles AB and BC respectively. Given the height of pole A, C and the length of rope x and y help Bima calculate the the height of pole B. You should minimize B. I've decreased the constraints so don't worry about precision error :) It is guaranteed that there will be an answer. The ropes cannot be loose. The pole's diameter is negligible.
Refer to the image below for better understanding.
Input
A C x y
Output
The height of pole B correct to 3 decimal places.
Examples
Input 1: 10 20 10 18.973665961 Output 1: 2.000000
Input 2: 10 7 8.5 6.0207972894 Output 2: 2.500
Constraints
- 1 ≤ A ≤ 500000
- 1 ≤ C ≤ 500000
- 1 ≤ x ≤ 500000
- 1 ≤ y ≤ 500000
hide comments
Oleg:
2023-01-06 02:06:38
I still see tests where this triggers assertion error:
|
|
Simes:
2022-11-27 11:57:35
@Juan, you should add a test case like 10 10 5 5. My first AC code gave 0, which is obviously wrong. |
|
[Rampage] Blue.Mary:
2022-03-13 01:36:49
I've resubmitted my AC solution and it gets WA.
|
|
Oleg:
2022-03-12 20:35:52
WARNING: After tests updated in 2020-08, there was no accepted solutions. Suspect mistakes in updated test.
|
|
David:
2022-02-03 18:35:13
Does "correct to 3 decimal places" mean truncate to 3 decimal places or round to 4 decimal places? Description and output is unclear, as there are two different number of decimal places in output.
|
|
Oleg:
2020-08-13 02:17:11
Is it correct drawing of first case after rotating poles? https://imgur.com/TdsWVVR
|
|
nadstratosfer:
2020-05-21 15:59:44
Please get rid of HTML formatting that messes up the dark mode view: http://imgbox.com/bix7PScc .
|
Added by: | Juan |
Date: | 2020-05-21 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | own problem |