Missile Troubles

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Dmojistan has declared war on Pegland! Both countries have sent a missile towards each other, but due to a miscalculation, the missiles are going to collide mid-flight. The missiles are traveling over neutral Wlmojistan, and they are going to unleash terrors like internal errors, TLEs and undefined behaviours. Thankfully, MCPT, the Missile Collision Prevention Team has a device that can neutralize both missiles if provided their collision point. Given the coordinates of the starting and ending position of both missiles, determine the collision point of the missiles.

Input Specification

The first line of input contains four integers, X_1, Y_1, X_2, and Y_2, the starting and ending coordinates of the first missile.

The second line of input contains four integers, X_1, Y_1, X_2, and Y_2, the starting and ending coordinates of the second missile.

Output Specification

Output the coordinate of the collision point of the two missiles. Round values to 1 decimal place.

Constraints

0 \le X_1,Y_1,X_2,Y_2 \le 500

Sample Input

0 3 4 5
0 10 3 1

Sample Output

2.0 4.0

Comments