m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/10/b.rb
blob: d27f1abf2f97944b223622d8df9506181b32a893 (plain)
1
2
3
4
5
6
7
lines = File.readlines('input.txt').map { |l| l.to_i }.unshift(0).sort!
arrs = Hash.new 0
arrs[0] = 1
lines.slice(1, lines.size).each do |line|
  arrs[line] += arrs[line - 1] + arrs[line - 2] + arrs[line - 3]
end
puts arrs[lines.last]