Problema de Fizica

Indicatii si rezolvari complete pentru exercitii si probleme.
Mesaje: 424
Membru din: 10 Mai 2012, 17:22

Problema de Fizica

Mesaj de Zeus » 11 Iun 2021, 11:00

Minimum speed required
Bob is playing a game. He and his team have come up with a plan to throw a ball so that It can hit the target object. The target is at a distance of X meters from Bob. He is at a height of Y meters from the ground and the target is at a height of Z meters from the ground. Bob can throw the ball with a certain speed.


Determine the speed that he should throw the ball.


He is aiming at an angle parallel to the ground.
Assume acceleration due to gravity is 10m/s2.


X = 2
Y = 5
Z = 2

It can be calculated that he needs to fire at speeds 2.58m/s at an angle parallel to the ground respectively. The answers are taken up to 2 decimal places only. Hence, the answer is 2.58 m/s.

Function description

Complete the solve function provided in the editor. This function takes the following 3 parameters and returns the minimum speed required:

X: Represents an integer denoting the distance of the target from Bob

Y: Represents an integer denoting the height of Bob from the ground

Z: Represents an integer denoting the height of the target from the ground

Input format

Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).

The first line contains an integer T denoting the number of test cases. T also denotes the number of times you have to run the solve function on a different set of inputs.
For each test case:
The first line contains three integers X, Y, and Z respectively.
Output format

For each test case, print the answer representing the required speed that should be set by Bob to hit the target.


Code snippets (also called starter code/boilerplate code)

This question has code snippets for C, CPP, Java, and Python.

Scrie răspuns
  • Subiecte similare
    Ultimul mesaj