NECSTASY - Ecstasy

no tags 


Swapnil loves to ride swings at the local park, he feels ecstatic on riding one! However, the park plot is recently being used up for the construction of a public building. Swapnil had been depressed, until his mother decided to put up a swing right beside their home!

Swapnil’s mom Swagata is now faced with a new problem. She has decided on the position of the swing in her yard, but height of the swing needs critical calculation.

Swagata has picked point A (directly downward from the hanging point) in her yard such that A has a perpendicular distance of d meters from the foot of their house. His feet need clearance of x meters above the ground, and y meters away from the building. Swapnil can keep balance while riding the swing if the swinging angle does not exceed theta-degrees. Your task is to calculate the maximum height h of Swapnil’s swing.


Input file contains multiple test cases. Each test case begins with a line containing three positive floating-point numbers- d, x and y (0<x,y<d<100) in meters. Next line of test case contains another floating point number, which is the maximum swinging angle theta in degrees (0<theta<180). It is guaranteed that all test cases will have a valid answer.


For each sample input, output the maximum height h of the swing in meters with exactly two digits after decimal point.


30.0 2.0 3.0
56.32 1.1 2.3


hide comments
horcrux2301: 2017-01-25 09:36:45

@shadowfax What is the use of EOF ?

Bhumit: 2016-09-06 12:22:35

getting WA in Java
Used DecimalFormat to round off.
Any suggestions?
Can you please look into my submission? ID=17659310

Finally AC. :) Stupid mistake ..

Last edit: 2016-09-08 13:11:06
Shubhransh Srivastav: 2015-12-21 13:20:52

For those who are getting wa use acos(-1) in place of pi

shadowfax: 2015-12-06 21:11:59

There are less than 1000 test cases. Input ends with EOF.

shadowfax: 2015-12-06 21:09:46

You should round the answer to tow digits after decimal point.

virdi_jasmin: 2015-11-29 19:20:00

Last edit: 2015-11-29 19:25:49
vicky: 2015-11-28 16:29:20

please anyone tell me that how many testcase i have to take

Bhargav Golla: 2015-11-25 23:43:08

Should we round the answer to two digits after decimal point or just print the number till two digits after decimal point? Could you also check what is wrong with my submission 15709141?

Added by:imranziad
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY
Resource:AIUB CS Fest 2015 (Nuzhat Subrina)