a583: 1. 座位距離計算問題
編輯歷史
| 時間 | 作者 | 版本 |
|---|---|---|
| 2017-07-19 14:09 – 14:09 | r0 – r1 | |
顯示 diff-
+ 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)))
|
||