Good day! I know the name is strange, now I will explain. According to the task, it is necessary to find the area of the rectangle through the triangles of which this 4 square consists (Photo). Using the formula of Gerona, I wrote the following piece of code:
import math n = int(input()) cor = [] for i in range(0,n): cor.append(input()) g = list(map(int,cor[0].split(sep=' '))) so = 0 #Переменная для общей площади for i in range(0, 6, 2): a = math.sqrt((g[2+i]-g[4+i])**2+(g[3+i]-g[5+i])**2) #Длинна сторон a,b,c b = math.sqrt((g[3+i]-g[0])**2+(g[3+i]-g[1])**2) c = math.sqrt((g[2+i]-g[0])**2+(g[3+i]-g[1])**2) p = (a+b+c)/2 #Полупериметр s = math.sqrt(math.fabs(p*(pa)*(pb)*(pc)))#Площадь по формуле Герона so+=s print(so) But the wrong area is displayed! PS The first two values in the list are the coordinates of the common vertex point of the triangles. Input example: 1
5 2 2 1 6 1 6 3 2 3
The answer must be equal to 8
[
]