👀

配列 倍数カウント

2024/02/06に公開

ttps://paiza.jp/works/mondai/c_rank_level_up_problems/c_rank_for_step1/edit?language_uid=ruby

n = gets.chomp.to_i
a = gets.split.map(&:to_i)
puts a.count{|n| n % 3 == 0}

https://docs.ruby-lang.org/ja/latest/method/Array/i/count.html

Discussion