m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/05/a.rb
blob: 877abb9402dc93f26df0e300a52c94a07915774c (plain)
1
2
3
4
5
6
7
8
9
10
11
max = 0
File.readlines('input.txt').map do |line|
  line.tr('FBLR', '0101')
end.each do |line|
  row = line.slice(0, 7).to_i 2
  seat = line.slice(7, 3).to_i 2
  id = row * 8 + seat
  max = [id, max].max
end

puts max