CF203D.Hit Ball
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
When Valera was playing football on a stadium, it suddenly began to rain. Valera hid in the corridor under the grandstand not to get wet. However, the desire to play was so great that he decided to train his hitting the ball right in this corridor. Valera went back far enough, put the ball and hit it. The ball bounced off the walls, the ceiling and the floor corridor and finally hit the exit door. As the ball was wet, it left a spot on the door. Now Valera wants to know the coordinates for this spot.
Let's describe the event more formally. The ball will be considered a point in space. The door of the corridor will be considered a rectangle located on plane xOz, such that the lower left corner of the door is located at point (0, 0, 0), and the upper right corner is located at point (a, 0, b) . The corridor will be considered as a rectangular parallelepiped, infinite in the direction of increasing coordinates of y. In this corridor the floor will be considered as plane xOy, and the ceiling as plane, parallel to xOy and passing through point (a, 0, b). We will also assume that one of the walls is plane yOz, and the other wall is plane, parallel to yOz and passing through point (a, 0, b).
We'll say that the ball hit the door when its coordinate y was equal to 0. Thus the coordinates of the spot are point (_x_0, 0, _z_0), where 0 ≤ _x_0 ≤ a, 0 ≤ _z_0 ≤ b. To hit the ball, Valera steps away from the door at distance m and puts the ball in the center of the corridor at point
. After the hit the ball flies at speed (v__x, v__y, v__z). This means that if the ball has coordinates (x, y, z), then after one second it will have coordinates (x + v__x, y + v__y, z + v__z).
See image in notes for clarification.
When the ball collides with the ceiling, the floor or a wall of the corridor, it bounces off in accordance with the laws of reflection (the angle of incidence equals the angle of reflection). In the problem we consider the ideal physical model, so we can assume that there is no air resistance, friction force, or any loss of energy.
当瓦列拉在体育场踢足球时,突然下起了雨。为了不被淋湿,瓦列拉躲进了看台下方的走廊里。然而,他踢球的愿望非常强烈,于是决定就在这个走廊里练习射门。瓦列拉向后退了足够远的距离,将球放在地上并踢出。球在走廊的墙壁、天花板和地板上多次反弹,最终击中了出口的门。由于球是湿的,它在门上留下了一个印记。现在瓦列拉想知道这个印记的坐标。
我们更形式化地描述这一事件:球被视为空间中的一个质点;走廊的门视为位于 xOz 平面上的一个矩形,其左下角位于点 (0,0,0),右上角位于点 (a,0,b);走廊本身被视为一个沿 y 坐标正方向无限延伸的长方体(即矩形平行六面体)。在此模型中,走廊的地面为 xOy 平面,天花板为与 xOy 平行且过点 (a,0,b) 的平面;一侧墙壁为 yOz 平面,另一侧墙壁为与 yOz 平行且过点 (a,0,b) 的平面。
我们定义:当球的 y 坐标等于 0 时,即视为球击中了门。因此,印记的坐标为点 (x0,0,z0),其中 0≤x0≤a,0≤z0≤b。为完成这次射门,瓦列拉从门后退距离 m,并将球置于走廊中心处的点
。踢出后,球以速度 (vx,vy,vz) 飞行——即若球当前坐标为 (x,y,z),则经过一秒后其坐标变为 (x+vx,y+vy,z+vz)。
参见笔记中的图示以进一步理解。
当球与走廊的天花板、地面或墙壁发生碰撞时,其反弹遵循反射定律(入射角等于反射角)。本题采用理想物理模型,即忽略空气阻力、摩擦力及任何能量损耗。
输入格式
The first line contains three space-separated integers a, b, m (1 ≤ a, b, m ≤ 100). The first two integers specify point (a, 0, b), through which the ceiling and one of the corridor walls pass. The third integer is the distance at which Valera went away from the door.
The second line has three space-separated integers v__x, v__y, v__z (|v__x|, |v__y|, |v__z| ≤ 100, v__y < 0, v__z ≥ 0) — the speed of the ball after the hit.
It is guaranteed that the ball hits the door.
第一行包含三个以空格分隔的整数 a、b、m(1≤a,b,m≤100)。前两个整数指定了点 (a,0,b),天花板与走廊的一面墙均经过该点。第三个整数表示瓦列拉从门处离开的距离。
第二行包含三个以空格分隔的整数 vx、vy、vz(∣vx∣,∣vy∣,∣vz∣≤100,且 vy<0,vz≥0)——即球被击出后的速度。
保证球会击中门。
输出格式
Print two real numbers _x_0, _z_0 — the x and z coordinates of point (_x_0, 0, _z_0), at which the ball hits the exit door. The answer will be considered correct, if its absolute or relative error does not exceed 10 - 6.
输出两个实数 x0、z0 —— 即球击中出口门时所在点 (x0,0,z0) 的 x 坐标与 z 坐标。若答案的绝对误差或相对误差不超过 10−6,则视为正确。
输入输出样例
输入#1
7 2 11 3 -11 2
输出#1
6.5000000000 2.0000000000
输入#2
7 2 11 4 -3 3
输出#2
4.1666666667 1.0000000000
说明/提示

输入解题思路,AI测评打分。不知道怎么写?