RPLH - Hard Launching

no tags 

Felix, the cat, decided to play in the afternoon with some melons, he built a “melon launcher” and started pointing to targets. Soon he noticed that the melons sometimes overflies the victims or don't even get close to them.

The melon launcher can be rotated so it can shoot from an angle from 0 to 45 degrees.

Felix isn't good at maths, so he ask you to code a program that, given the target (in meters) distance and the speed (in meters / sec) you can give him the perfect angle for the melon launcher.

The gravity to be considered is of 9.806 meters / sec^2

PI value to be considered is 2*acos(0.0).


The first line of input will contain an integer T denoting the T test cases, then, T cases will follow. Each of the following line will contain two integer numbers Ta and Sp, denoting the distance of the target and the speed of the melon respectively.


Output the string “Scenario #i: “ where i is the test case you are analyzing followed by a single number D, denoting the Degrees necessary to do the launch, if the launching can't be done, output D as -1. the number must have a precision of 2 decimal digits.


10 10
10 9
8 9

Scenario #1: 39.35
Scenario #2: -1
Scenario #3: 37.79


0 < Ta, Sp < 10000

hide comments
shubham_03: 2019-01-09 15:13:20

Alert during conversion..

sonuverma: 2018-01-17 14:15:02

for inverse, use acos(x) or asin(x) in c :-)

bayulaxana: 2017-12-28 14:09:13

do this with physics...
Projectile Motion

nadstratosfer: 2017-08-25 07:57:07

- brag at every solved problem comments about how "EZ" it was,
- keep getting WA's because of failing to copy/paste output specification written in plain text,
- get a job writing software for the rest of us,
- profit!!1 while we're banging our heads wondering who wrote this %&$#.

Anand: 2017-01-20 07:54:09

SAME! TLE for java seems tooooo strict even with fast IO

shubham_cs_iet: 2016-12-23 07:27:13

here the given distance is the horizontal range of projectile.

get_right_jr: 2016-05-31 13:29:33

Submitted in C - AC - time=0.00
Submitted the same solution in Java with threading and custom IO functions - TLE

minhthai: 2016-01-18 11:55:30

so we physics now :)
why tle for java, why...

TUSHAR SINGHAL: 2015-06-10 13:58:26

remember there is a space betweeen colon and answer /.......costed me 2 wa before enlightment

Archit Joshi: 2015-05-22 18:29:42

2 TLE plzzzz helppp

Added by:david_8k
Time limit:0.158s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem used for the RPL contest