[2023][ruby][4.2] cleanup

main
Alpha Chen 12 months ago
parent 0d0cc439b0
commit eb21642bf4
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -17,9 +17,6 @@ wins = Hash.new {|h,k|
winners = winning & card
new_cards = (1..winners.length).map { k + _1 }
h[k] = winners.empty? ? 1 : 1 + new_cards.sum { h[_1] }
h[k] = 1 + (winners.empty? ? 0 : new_cards.sum { h[_1] })
}
p cards.map {|id,(winning,card)|
wins[id]
}
.sum
p cards.keys.sum { wins[_1] }

Loading…
Cancel
Save