The problem with connected points and the definition of geometric shapes based on the analysis of the location of points

We have a really serious problem at school, and so far none of the students have solved it. Take a look at the picture below:

http://d.imagehost.org/0422/mreza.gif

This is a kind of network of connected points that does not end, and each point has its own number representing it. Let's say the numbers are: 1-23-456-78910, etc. etc. (You do not see the number 5 or 8.9 ... in the picture, but they are there, and their position is obvious, the point in the middle of 4 and 6 is 5 and so on).

1 connected to 2 and 3, 2 connected to 1,3,5 and 4, etc.

Numbers 1-2-3 show that they are a triangle in the image, but the numbers 1-4-6 are not related to the fact that 4 is not directly related to 6.

Let's look at 2-3-4-5 that a parallelogram (you know why), but 4-6-7-9 is NOT a parallelogram, because there is a rule in this problem, which says that all parties should be equal for all figures - triangles and parallelograms.

Hexagons also exist, for example. 4-5-7-9-13-12 - hexagon - all sides should be equal here.

12345 - this does not represent anything, so we ignore it.

I think I have well explained this problem. The actual problem that is given to us using the input of numbers as indicated above to determine if it is a triangle / parallelogram / hexagon (in accordance with the rules described).

For ex:

1 2 3 - triangle
11 13 24 26 -parallelogram
1 2 3 4 5 - nothing
11 23 13 25 - nothing
3 2 5 - triangle

I read computational geometry to solve this problem, but I quickly gave up, nothing helps. One of my friends told me this site, so I decided to give it a try.

, , , ++. .

+3
1

:

1
2  3
4  5  6
7  8  9  10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28

. row[i] = the row number i is on col[i] = the column number i is on. i.

. 3 , 4 6 - , .

, , . A, B, C. , , row[A] row[B], col[B] col[C], row[C] row[A] , . , , B 8 A 1, , , 11 1.

. 4 A, B, C, D (, ). , col[A] col[B] , col[C] col[D] , row[A] row[C], ( , !) ​​ row[B] row[D].

, . :

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36

, , .

, .

row col, . , , .

, 256x256, , , . , , , . , , - , , ..

+1

Source: https://habr.com/ru/post/1737743/


All Articles