[2020][ruby][3.x] this is better

master
Alpha Chen 4 years ago
parent ea6d3fed3b
commit 3601c50b22

@ -9,7 +9,7 @@ slopes = [
[1, 2], [1, 2],
] ]
puts slopes.map {|dx,dy| puts slopes.map {|dx,dy|
map.each_slice(dy).map(&:first) Array.new(rows / dy) {|i| [dx*i % cols, dy*i] }
.map.with_index {|row,i| row[dx*i % cols] } .map {|x,y| map[y][x] }
.count(?#) .count(?#)
}.reduce(&:*) }.reduce(&:*)

Loading…
Cancel
Save