AOC day 1

This commit is contained in:
aliasless 2019-12-01 14:31:46 -08:00
commit 3eb3276435
6 changed files with 225 additions and 0 deletions

14
1.2/1.2.lua Executable file
View File

@ -0,0 +1,14 @@
#!/bin/lua
local fuel = 0
for mass in io.lines("input") do
repeat
local requires = math.floor(tonumber(mass) / 3) - 2
if requires <= 0 then break end -- magic fuel we dont need to add more fuel for
fuel = fuel + requires
mass = requires -- the fuel we require is the mass we need to calculate next time
until false
end
print(fuel)

1
1.2/answer Normal file
View File

@ -0,0 +1 @@
5250885

100
1.2/input Normal file
View File

@ -0,0 +1,100 @@
80228
76027
101696
66033
127249
104564
88957
82536
131331
62571
129935
138764
122011
82908
83358
56584
85483
110398
87103
145728
87305
116387
145243
118656
92624
86152
81056
98776
109949
126863
131046
134570
97818
123881
105902
60102
100226
101041
70950
110903
71779
80531
144679
100346
130079
55606
92984
136022
126633
77104
118037
148426
62327
56250
133496
69308
125495
122131
56864
127532
94194
64268
80166
83250
96506
87668
142137
142915
148287
109471
79349
148270
104627
109657
86225
111411
144666
91402
140834
138587
117809
114288
126467
100089
78745
92180
89969
128868
128085
129931
64047
71968
111512
143771
149658
146102
52655
130193
109013
120465

9
1/1.lua Executable file
View File

@ -0,0 +1,9 @@
#!/bin/lua
local fuel = 0
for mass in io.lines("input") do
fuel = fuel + math.floor(tonumber(mass) / 3) - 2
end
print(fuel)

1
1/answer Normal file
View File

@ -0,0 +1 @@
3502510

100
1/input Normal file
View File

@ -0,0 +1,100 @@
80228
76027
101696
66033
127249
104564
88957
82536
131331
62571
129935
138764
122011
82908
83358
56584
85483
110398
87103
145728
87305
116387
145243
118656
92624
86152
81056
98776
109949
126863
131046
134570
97818
123881
105902
60102
100226
101041
70950
110903
71779
80531
144679
100346
130079
55606
92984
136022
126633
77104
118037
148426
62327
56250
133496
69308
125495
122131
56864
127532
94194
64268
80166
83250
96506
87668
142137
142915
148287
109471
79349
148270
104627
109657
86225
111411
144666
91402
140834
138587
117809
114288
126467
100089
78745
92180
89969
128868
128085
129931
64047
71968
111512
143771
149658
146102
52655
130193
109013
120465