Skip to content

Commit 556e02c

Browse files
committed
チェビシェフ距離の関数を追加した
1 parent 43b72e8 commit 556e02c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libs/dis.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ def manhattan_45turn(x: int, y: int) -> Tuple[int]:
3131
res_y = x + y
3232

3333
return res_x, res_y
34+
35+
36+
def chebyshev_dis(x1: int, y1: int, x2: int, y2: int) -> int:
37+
"""
38+
チェビシェフ距離を計算します
39+
"""
40+
41+
return max(abs(x1 - x2), abs(y1 - y2))

0 commit comments

Comments
 (0)