adventofcode-2021/day01/part2.lua

13 lines
210 B
Lua
Raw Normal View History

2021-12-05 12:17:39 +01:00
#!/usr/bin/env luajit
2021-12-01 08:03:56 +01:00
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)