一、称检测点查询
1.题目描述
2.源代码
m = list(map(int,input().split()))
res = []
dic1= {}
#计算每个点到市民之间的距离
for i in range(m[0]):
temp = list(map(int,input().split()))
temp1 = (m[1]-temp[0])**2+(m[2]-temp[1])**2
res.append(temp1)#中间缓存
dic1[i] = temp1#一一对应的存
res.sort()
count = 0
ans = []
while count < 3:
for i in res:#从小到大的遍历
for j in dic1:
if count == 3:
break
if dic1[j] == i:#确保没有重复
if j+1 not in ans:
ans.append(j+1)
count += 1
if count == 3:
break
for i in ans:
print(i)
总结
暴力方法,算出每个检测点到市民的距离,用一个列表来缓存,用字典来存真实信息。嗯,智商不够,暴力来凑。