LCC/Moose '19 Contest 4 J4 - Inaho's Walk

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Inaho is taking a walk! He texts you the location he walks to from his house, which is located at the origin (0, 0) on a 2D plane. You know that the location has coordinates (x, y). However, Inaho can only walk in 2 directions: v and w.

v is defined as the direction from (0, 0) to (v_x, v_y), and Inaho defines that distance as 1 V.

w is defined as the direction from (0, 0) to (w_x, w_y), and Inaho defines that distance as 1 W.

Help Inaho determine how far in each direction he must travel in order to reach his destination.

Input Specification

The first line will contain the integers x, y\ (-10^6 \le x, y \le 10^6).

The next line will contain the integers v_x, v_y\ (-10^6 \le v_x, v_y \le 10^6).

The next line will contain the integers w_x, w_y\ (-10^6 \le w_x, w_y \le 10^6).

Output Specification

Output 2 space separated real numbers, the number of Vs and Ws Inaho must travel in direction v and w, respectively. It is guaranteed that there is exactly 1 distinct solution. Your output will be considered correct if it has a relative error of at most 10^{-6}.

Subtasks

Subtask 1 [30%]

(-10^3 \le x, y, v_x, v_y, w_x, w_y \le 10^3)

It is guaranteed that the number of Vs and Ws will be integers.

Subtask 2 [70%]

No further constraints.

Sample Input

9 10
1 2
3 4

Sample Output

-3 4

Explanation for Sample 1

Inaho can first travel -3 Vs, after which he will move 3 units left and 6 units down, ending up on the point (-3, -6). Then he can travel 4 Ws, after which he will move 12 units end right and 16 units up, ending up on the point (9, 10).


Comments

There are no comments at the moment.