본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 30315번 King's Keep

by 현장 2024. 6. 6.

-Code

from math import sqrt

res = 1e9
t = int(input())
arr = [list(map(int, input().split())) for _ in range(t)]

for i in range(t):
    x, y = arr[i][0], arr[i][1]
    temp = 0
    for j in range(t):
        if i == j:
            continue
        x2, y2 = arr[j][0], arr[j][1]
        temp += sqrt((x - x2) ** 2 + (y - y2)  ** 2)

    temp /= (t - 1)
    res = min(res, temp)

print(res)