class Yukicoder def initialize n = gets.to_i answer = 0 nums = [] n.times do a = gets.to_i nums << a end d = nums.inject(:gcd) puts nums.map{|i| i/d}.inject(:+) end end Yukicoder.new