def gi gets.to_i end def gm gets.split.map(&:to_i) end def gc gets.chomp end def gf gets.to_f end n = gi sum = 0.0 (1..n).each do |i| x = gi sum += Math.sqrt(x) puts format("%.20f", sum) end