diff --git a/2019/day-1/python/main.py b/2019/day-1/python/main.py index 68fb361..152dda4 100644 --- a/2019/day-1/python/main.py +++ b/2019/day-1/python/main.py @@ -6,14 +6,13 @@ 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 -ADVANCED_FUEL = lambda mass : BASIC_FUEL(mass) + (BASIC_FUEL(BASIC_FUEL(mass)) if BASIC_FUEL(mass) > 0 else 0) -# def ADVANCED_FUEL(mass): -# total = 0 -# while mass > 0: -# mass = BASIC_FUEL(mass) -# total += mass if mass >= 0 else 0 -# return total +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))) \ No newline at end of file diff --git a/2019/day-2/input b/2019/day-2/input new file mode 100644 index 0000000..e69de29 diff --git a/2019/day-2/python/main.py b/2019/day-2/python/main.py new file mode 100644 index 0000000..40d0d68 --- /dev/null +++ b/2019/day-2/python/main.py @@ -0,0 +1,5 @@ +import os +import sys + +PATH = os.path.join(sys.path[0], '..', 'input') +DATA = list(map(int, open(PATH, 'r').readlines())) \ No newline at end of file