Created
December 20, 2018 11:47
-
-
Save hugefiver/981546dc7c968b3fddeba082946c2c4f to your computer and use it in GitHub Desktop.
一些奇怪的示范
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awsl