题目: 解法1:graph+dfs 解法与上面说的思路一样 import math import collections def cal_dis(x1,y1,x2,y2): return math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) k = 7 points = [(0,1),(0,2),(0,3),(0,4),(0,10),(0,11),(0,100),(0,101)] graph = collections.defaultdict(set)