Problem A
Beach Ball Serve
Alice is having fun at Wally’s Water Park playing beach volleyball. The park has a challenge to serve the ball as far as possible to win a special pass that will give her free access to the park every 7 days. Alice wants to know the maximum distance she can serve the ball before it hits the ground, and the angle she needs to serve the ball at to achieve that distance. During her serve, Alice knows she can hit the ball at $V$ speed and at any angle, and she hits the ball when it is $H$ height above the ground.
Unfortunately Alice is not playing beach volleyball in a vacuum (she needs to breathe!) so the ball experiences some air resistance.
Alice has spent the entire day practising, and has collected the following information to help her win the special pass, where $\theta $ is the angle above the horizon that she serves the ball:
-
The initial position of the ball right after Alice hits the serve is $H$ $cm$ above the ground.
-
The initial velocity of the ball right after Alice hits the serve is $V$ $cm/s$ at any angle.
-
The horizontal velocity $V_x$ of the ball will be $V\cos {\theta }$ right after Alice hits the serve.
-
The vertical velocity $V_y$ of the ball will be $V\sin {\theta }$ right after Alice hits the serve.
-
The ball accelerates downwards due to gravity at $981$ $cm/s^2$.
-
The ball experiences air resistance, resulting in acceleration equal to $ -0.01 \times R \times \vec{v} $ $cm/s^2$, where $\vec{v}$ is the current velocity of the ball in $cm/s$, and $R$ is the air resistance multiplier. Note the negative sign, which means that the acceleration is in the opposite direction as the velocity.
Input
The input consists of a single line containing three integers $1 \leq V \leq 1000$, $1 \leq H \leq 300$, $1 \leq R \leq 200$.
Output
Output two decimal numbers, the maximum distance Alice can serve the ball in $cm$, and the angle above the horizon, in degrees, she needs to serve the ball to achieve that distance. The angle should be normalized to be between -90 and 90 degrees. Your answers should have an absolute error or relative error of at most $10^{-3}$.
Sample Input 1 | Sample Output 1 |
---|---|
500 200 1 |
406.697090810821 31.8243345303016 |
Sample Input 2 | Sample Output 2 |
---|---|
100 200 10 |
63.22846961192418 8.581789933011834 |