print1421. Bullet Hole

printBullet Hole

Ограничения: время – 1s/2s, память – 64MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

A projectile is launched in three-dimensional space and travels through the air, forced down- ward by gravity, but otherwise unaffected by friction or other forces. There is a vertical target plane through which the projectile will eventually penetrate, unless it travels away from or parallel to the target plane. In this problem, we are given the initial velocity `vec{v}` (i.e. the speed and direction as a 3-dimensional vector) of a projectile and the position of a target plane and are asked to compute the exact point in 3-dimensional space at which the projectile impacts the target plane.
The projectile is launched at time `t\ =\ 0` from the origin `(0,\ 0,\ 0)` traveling at a velocity `vec{v}\ =\ (v_x,\ v_y,\ v_z)` whose speed components in the `x`-, `y`- and `z`-direction are `v_x`, `v_y` and `v_z` m/sec, respectively. The force of gravity causes a downward (i.e. negative `z`-direction) acceleration on the projectile of `9.8\ m//sec^2`. I'm sure you recall from your physics class that the position of the projectile after `t` seconds is
`(v_x\ t,\ v_y\ t,\ v_z\ t\ -\ {9.8t^2}/2)`
The target plane is a vertical plane consisting of all points `(x,\ y,\ z)` satisfying a linear equation
`"ax"\ +\ "by"\ =\ c`.
Input Format
The input contains one or more trials, each described on two lines of input followed by an empty line of input. The first line of each trial contains three integers `v_x,\ v_y,\ v_z` defining the initial velocity `vec{v}\ =\ (v_x,\ v_y,\ v_z)` of the projectile. The second line of each trial contains three integers `a,\ b,\ c` defining the vertical target plane `"ax"\ +\ "by"\ =\ c`.
Output Format
For each trial, compute the time `t` (in seconds after the launch) and the point `(x,\ y,\ z)` at which the projectile impacts the target plane. Report `t`, `x`, `y` and `z` rounded to two decimal places as shown in the output sample. If the projectile travels away from or parallel to the target plane, report that instead.

Sample Input

1 1 0
1 1 10

1 1 10
-1 1 -1

-1 -1 10
1 1 10

34 -25 201
-10 5 -32

Sample Output

Impacts after 5.00 seconds at position (5.00, 5.00, -122.50)
Travels parallel to plane
Travels away from plane
Impacts after 0.07 seconds at position (2.34, -1.72, 13.81)
Source: California State Polytechnic University Programming Contest, Spring 2008
loading