DWITE '09 R2 #1 - Angles

View as PDF

Submit solution

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

Problem type
DWITE Online Computer Programming Contest, November 2009, Problem 1

Angles are a vital part of game physics, and are relevant to velocities, collisions, and other interactions between objects. As such, it's important to be able to accurately calculate angles between points.

The input will contain 5 lines, each containing two points, (x_1, y_1), (x_2, y_2). All values are integer values -100 \le n \le 100. The angle should be calculated between the first point, the origin at (0,0), and the second point, in a clockwise direction.

It is guaranteed that both points will not be at (0, 0).

The output will contain 5 lines, each a corresponding angle between the points through the origin, rounded to the nearest \frac{1}{10}th of a degree. If the angle is a whole degree, output the trailing .0.

Sample Input

71 71 100 0
100 0 71 71
0 100 0 -100
-100 0 0 -100

Sample Output

45.0
315.0
180.0
270.0

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments

There are no comments at the moment.