#C4886. Calculate Object Impact Speeds
Calculate Object Impact Speeds
Calculate Object Impact Speeds
In this problem, you are given several test cases where each test case describes a scenario of falling objects. Each test case provides:\ (G): the number of objects, \ A list of gravitational accelerations, \ A height value (H) (this value is provided but is not used in the speed calculation), and\ A list of time durations (in seconds) during which each object falls.\ \ The speed of an object upon impact is calculated using the formula: \ [ v = g \times t ] \ where (g) is the gravitational acceleration and (t) is the time of fall. The result should be rounded to two decimal places for each object.\ \ Your task is to process the input from standard input (stdin) and for each test case output a single line containing the speeds of all objects (in the same order as provided) separated by a space. Each test case's output should be on a new line. The answer must pass all the provided test cases.
inputFormat
The input is read from standard input (stdin) and has the following format:\ \ The first line contains a single integer (T) denoting the number of test cases.\ For each test case, the input is as follows:\
- A line containing an integer (G), the number of objects.\
- A line containing (G) space-separated floating-point numbers representing the gravitational accelerations.\
- A line containing an integer (H) which represents the height (this value is provided but is not used in the calculations).\
- A line containing (G) space-separated floating-point numbers representing the time durations in seconds.\ \ Note: There is no extra delimiter between test cases.
outputFormat
For each test case, output a single line with (G) space-separated floating-point numbers representing the speeds calculated as (v = g \times t) (rounded to two decimal places). Each test case's result should appear on its own line.## sample
2
2
9.8 3.7
100
4.5 8.2
3
9.8 3.7 1.6
50
3.2 6.1 8.9
44.1 30.34
31.36 22.57 14.24
</p>