01
02 03
04 05 06
07 08 09 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 35 26 27 28
Note that a set of vertices of this grid may form a geometric shape.
For example, the sets {1,2,3} and {7,9,18} are the vertices of equilateral
triangles, the sets {11,13,26,24} and {2,7,9,18} are the vertices of
rhombi (a rhombus is an equilateral parallelogram), and the sets {4,5,9,13,12,7}
and {8,10,17,21,32,34} are the vertices of equilateral hexagons. The input consists of one or more lines, each of which contains from one to six distinct integers separated by spaces. Each integer represents a point on the grid, and will be in the interval [1,32767]. For each line of input, determine if the points are the vertices of an equilateral triangle, rhombus or equilateral hexagon, whose sides coincide with adjacent grid edges. (For example, {3,4,9} is not an acceptable figure.) Then output the set of points, followed by the appropriate message, exactly as shown in the example below (including spacing, punctuation and spelling). Note that sets of one, two or five points could not form an acceptable figure, a set of three points could only form an equilateral triangle, a set of four points could only form a rhombus, and a set of six points could only form an equilateral hexagon.
Input must be read from the file "prob1.in", and output must be
written to the file "prob1.out". All output to the screen will be
ignored.
<BOF> 1 2 3 11 13 29 31 26 11 13 24 4 5 9 13 7 12 1 2 3 4 5 47 11 13 23 25 <EOF>
{1,2,3} forms an equilateral triangle
{11,13,29,31} does not form an acceptable figure
{26,11,13,24} forms a rhombus
{4,5,9,13,7,12} forms an equilateral hexagon
{1,2,3,4,5} does not form an acceptable figure
{47} does not form an acceptable figure
{11,13,23,25} does not form an acceptable figure
Dr. Eric Shade