My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code/
advent-of-code python
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add solution for 2019/01

+117
+17
2019/day01.py
··· 1 + import fileinput 2 + 3 + def fuel(n): 4 + return (n // 3) - 2 5 + 6 + PART_1 = 0 7 + PART_2 = 0 8 + 9 + for line in fileinput.input(): 10 + n = int(line) 11 + PART_1 += fuel(n) 12 + while fuel(n) > 0: 13 + n = fuel(n) 14 + PART_2 += n 15 + 16 + print "Total fuel for Part 1:", PART_1 17 + print "Total fuel for Part 2:", PART_2
+100
2019/inputs/01.txt
··· 1 + 132897 2 + 131436 3 + 107839 4 + 98498 5 + 141198 6 + 147530 7 + 65491 8 + 142162 9 + 89575 10 + 95090 11 + 147097 12 + 129782 13 + 144858 14 + 68745 15 + 102201 16 + 103225 17 + 113363 18 + 111744 19 + 91402 20 + 72832 21 + 122801 22 + 121257 23 + 52343 24 + 73228 25 + 92718 26 + 147235 27 + 88278 28 + 86305 29 + 75761 30 + 63778 31 + 60566 32 + 125207 33 + 65341 34 + 72035 35 + 117227 36 + 101003 37 + 91830 38 + 121549 39 + 116387 40 + 62337 41 + 124495 42 + 76900 43 + 149440 44 + 94380 45 + 72932 46 + 74131 47 + 147816 48 + 137870 49 + 135540 50 + 99187 51 + 78513 52 + 81784 53 + 77323 54 + 122089 55 + 126365 56 + 148263 57 + 71299 58 + 56483 59 + 100098 60 + 118856 61 + 101395 62 + 106244 63 + 129590 64 + 104179 65 + 76867 66 + 57756 67 + 83790 68 + 80722 69 + 133943 70 + 78243 71 + 92963 72 + 69222 73 + 117193 74 + 63871 75 + 111459 76 + 107930 77 + 116514 78 + 124433 79 + 84165 80 + 144701 81 + 144033 82 + 99114 83 + 52861 84 + 86496 85 + 134584 86 + 126356 87 + 149743 88 + 70192 89 + 142814 90 + 73271 91 + 111543 92 + 60035 93 + 146067 94 + 100679 95 + 116636 96 + 104316 97 + 84510 98 + 59851 99 + 101893 100 + 55611