Skip to content

Instantly share code, notes, and snippets.

@hugefiver
Created December 20, 2018 11:47
Show Gist options
  • Save hugefiver/981546dc7c968b3fddeba082946c2c4f to your computer and use it in GitHub Desktop.
Save hugefiver/981546dc7c968b3fddeba082946c2c4f to your computer and use it in GitHub Desktop.
一些奇怪的示范
from itertools import starmap
points = [
(5, 16),
(15, 11),
(3, 5),
(28, 9),
(24, 25),
(11, 7),
(14, 22),
(26, 12),
(9, 30),
(16, 29),
]
def get_ranges(points):
return [(lambda l=(points[i], points[j]): ((lambda p1, p2: __import__('math').sqrt(sum(starmap(lambda x, y: (x-y)**2, zip(p1, p2)))))(*l), *l))()
for i in range(len(points)-1) for j in range(i+1, len(points))]
print(*(lambda t: ("%.3f" %t[0], *t[1:]))(min(get_ranges(points))))
@Anthony-Hoo
Copy link

awsl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment