aboutsummaryrefslogtreecommitdiff
path: root/day08/part1
blob: 5936286cc8fe5d1e3a009f82c58e0e5491561e79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env ruby

W = 25
T = 6

input = $stdin.readlines[0].strip.chars.map(&:to_i)

layers = input.each_slice(W * T).to_a

zeroest = layers.sort{ |a,b| a.count(0) <=> b.count(0) }.first

puts zeroest.count(1) * zeroest.count(2)