Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import product
- import math
- def compare(a, b):
- return abs(a - b) < 10 ** -6
- def vector(x1, y1, x2, y2):
- return math.sqrt((x2 - x1) ** 2 + (y2 -y1) ** 2)
- def test(x1, y1, x2, y2, x3, y3):
- a = vector(x1, y1, x2, y2)
- b = vector(x2, y2, x3, y3)
- c = vector(x3, y3, x1, y1)
- if a < b + c and b < a + c and c < b + a:
- if compare(a, b) and compare(b, c) and compare(c, a):
- return "ISOSCELES TRIANGLE" + " " + str(a)
- else:
- if compare(a, b) or compare(b, c) or compare(c, a):
- if not compare(a, b):
- return "EQUILATERAL TRIANGLE" + " " + str(min(a, b)) + " " + str(max(a, b))
- else:
- return "EQUILATERAL TRIANGLE" + " " + str(min(b, c)) + " " + str(max(b, c))
- else:
- return "SIMPLE TRIANGLE" + " " + str(a) + " " + str(b) + " " + str(c)
- else:
- return "NOT TRIANGLE"
- k = int(input())
- mapX = []
- mapY = []
- comb = []
- count = 0
- while count != k:
- count += 1
- x, y = input().split(" ")
- mapX.append(float(x))
- mapY.append(float(y))
- a = 0
- b = 0
- c = 0
- for a, b, c in product(range(k+1), range(k+1), range(k+1)):
- if (not (a == b or b == c or a == c)) and a != 0 and b !=0 and c != 0:
- if a < b and b < c:
- a -= 1
- b -= 1
- c -= 1
- result = test(mapX[a], mapY[a], mapX[b], mapY[b], mapX[c], mapY[c])
- print(a+1, b+1, c+1, "-", result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement