Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #7581 https://kpolyakov.spb.ru/school/ege/gen.php?action=viewAllEgeNo&egeId=27&cat183=on
- from math import dist
- data = open('27.txt').readlines()
- cl = [[], []]
- for e in data:
- x, y = map(float, e.replace(',', '.').split())
- if x < 1:
- cl[0].append((x, y))
- else:
- cl[1].append((x, y))
- cent = []
- for i in range(2):
- best_rst = 1000000000000
- best_c = 0
- for c in cl[i]:
- rst = 0
- for e in cl[i]:
- rst += dist(c, e)
- if rst < best_rst:
- best_rst = rst
- best_c = c
- cent.append(best_c)
- print(int(((cent[0][0] + cent[1][0]) / 2) * 10000), int(((cent[0][1] + cent[1][1]) / 2) * 10000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement