2025: improve folder names
This commit is contained in:
15
2024/01/1.py
Normal file
15
2024/01/1.py
Normal file
@ -0,0 +1,15 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
# Load both columns into numpy arrays of type int
|
||||
left, right = np.loadtxt("input", dtype=int).T
|
||||
|
||||
# Sort both lists (ASC)
|
||||
left.sort()
|
||||
right.sort()
|
||||
|
||||
# Just calculate the distances.
|
||||
distances = np.abs(left - right)
|
||||
distance = np.sum(distances)
|
||||
|
||||
print(f"The total distance is {distance}.")
|
||||
Reference in New Issue
Block a user