ECOO '12 R1 P3 - Triangles

View as PDF

Submit solution


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

Problem type

Who doesn't love a good equilateral triangle? Equilateral triangles have a lot of symmetry – so much so that if you fix one point of an equilateral triangle to the origin, then all you need is one other corner point to begin generating a tiling of identical equilateral triangles. In the examples below, the points labeled P were given as input, and the large equilateral triangles, each made up of 4 smaller, identically-sized ones, were generated automatically. Note that in these tilings, the third point of the innermost triangle is always counter-clockwise from the given point P, as shown by the arrow.

The input will contain 5 test cases. Each test case consists of two integers P_x and P_y, the x and y coordinates of point P. Your job is to compute the coordinates of the three corners of the large equilateral triangle constructed as described above. These coordinates should be rounded to one decimal place and reported on a single line. Each point should be bracketed and spaced exactly as shown, and there should be a space separating each point on the line. The order in which you report the three points on the line does not matter.

Sample Input

50 50
-25 70
-35 -23
35 -23
5 6

Sample Output

(-68.3,18.3) (68.3,-18.3) (31.7,118.3)
(-48.1,-56.7) (48.1,56.7) (-98.1,83.3)
(37.4,-18.8) (-37.4,18.8) (-32.6,-64.8)
(2.4,41.8) (-2.4,-41.8) (72.4,-4.2)
(-7.7,1.3) (7.7,-1.3) (2.3,13.3)

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org


Comments

There are no comments at the moment.