作业帮
笔试-作业帮-180925
单选 5,填空 5,编程 2,问答 2
编程不允许跳出页面
Index
1. 点对距离
Python(60%)
试了各种情况,不知道哪里有问题
```python
from math import ceil, floor
def foo(ax, ay, bx, by): d = ((ax - bx)2 + (ay - by)2)**0.5
k = int(input()) n = int(input())
P = [] for _ in range(n): x, y = list(map(float, input().split())) P.append([x, y])
D = [] for i in range(n): for j in range(i+1, n): d = foo(P[i][0], P[i][1], P[j][0], P[j][1]) D.append(d)
D.sort()
print(D)
N = len(D) - 1
print(N)
print(ceil(N * (k / 100)))
ans = D[ceil(N * (k / 100))]
print("%0.5f" % ans)
print(round(ans, 5))
print(ans)
最后更新于