a583: 1. 座位距離計算問題
http://zerojudge.tw/ShowProblem?problemid=a583
- from math import sqrt
-
- def D(A,B):
- return (A[0]-B[0])**2 + (A[1]-B[1])**2
-
- m = int(input().split(’ ’)[1])
- xy = input().split(’ ’)
- P = []
- Ds = []
- for i in range(m):
- P += [ ( int(xy[i*2]), int(xy[i*2+1]) ) ]
- for i in range(1,m):
- for j in range(i):
- Ds += [ D(P[i],P[j]) ]
-
- print(’%.4f’ % sqrt(min(Ds)))