14 lines
347 B
Python
14 lines
347 B
Python
with open("input", "r") as input:
|
|
input = list(map(int, input.read().strip().split(",")))
|
|
fuel = []
|
|
|
|
for i in range(min(input), max(input)):
|
|
total_fuel = 0
|
|
for x in input:
|
|
for y in range(1, abs(i - x) + 1):
|
|
total_fuel += y
|
|
fuel.append(total_fuel)
|
|
|
|
fuel.sort()
|
|
print(fuel[0])
|