Advertisement
nq1s788

27 кластеры A

Feb 8th, 2025
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=70554
  2. from math import dist
  3. data = open('demo_2025_27_А.txt').readlines()
  4. a = []
  5. for i in range(1, len(data)):
  6.     a.append(list(map(float, data[i].replace(',', '.').split())))
  7. min_sum = 10000000000000
  8. answ = ()
  9. for c1 in a:
  10.     for c2 in a:
  11.         sm = 0
  12.         for x in a:
  13.             sm += min(dist(x, c1), dist(x, c2))
  14.         if sm < min_sum:
  15.             min_sum = sm
  16.             answ = (c1, c2)
  17. print(int(((answ[0][0] + answ[1][0]) / 2) * 10000), int(((answ[0][1] + answ[1][1]) / 2) * 10000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement