day 1
This commit is contained in:
parent
9aa652953c
commit
9a85919a6f
10
Day01/Part1.lua
Normal file
10
Day01/Part1.lua
Normal file
@ -0,0 +1,10 @@
|
||||
local count = 0
|
||||
local previous
|
||||
for number in io.lines(arg[3]) do
|
||||
number = tonumber(number)
|
||||
if previous ~= nil and previous < number then
|
||||
count = count + 1
|
||||
end
|
||||
previous = number
|
||||
end
|
||||
print(count)
|
10
Day01/Part2.lua
Normal file
10
Day01/Part2.lua
Normal file
@ -0,0 +1,10 @@
|
||||
local count = 0
|
||||
local a, b, c
|
||||
for line in io.lines(arg[3]) do
|
||||
d = tonumber(line)
|
||||
if a ~= nil and a + b + c < b + c + d then
|
||||
count = count + 1
|
||||
end
|
||||
a, b, c = b, c, d
|
||||
end
|
||||
print(count)
|
2000
inputs/01.long
Normal file
2000
inputs/01.long
Normal file
File diff suppressed because it is too large
Load Diff
10
inputs/01.short
Normal file
10
inputs/01.short
Normal file
@ -0,0 +1,10 @@
|
||||
199
|
||||
200
|
||||
208
|
||||
210
|
||||
200
|
||||
207
|
||||
240
|
||||
269
|
||||
260
|
||||
263
|
Loading…
Reference in New Issue
Block a user