mirror of
https://github.com/Xevion/advent-of-code.git
synced 2025-12-06 01:14:18 -06:00
18 lines
409 B
Python
18 lines
409 B
Python
import os
|
|
import sys
|
|
import math
|
|
|
|
PATH = os.path.join(sys.path[0], '..', 'input')
|
|
DATA = list(map(int, open(PATH, 'r').readlines()))
|
|
|
|
BASIC_FUEL = lambda mass : math.floor(mass / 3) - 2
|
|
|
|
def ADVANCED_FUEL(mass):
|
|
total = 0
|
|
while mass > 0:
|
|
mass = BASIC_FUEL(mass)
|
|
total += mass if mass >= 0 else 0
|
|
return total
|
|
|
|
print(sum(map(BASIC_FUEL, DATA)))
|
|
print(sum(map(ADVANCED_FUEL, DATA))) |