gets la=gets.split.map(&:to_i) k=gets.to_i eps=1e-9 l=0.0 r=1e9 while [(l-r).abs,(l-r).abs/r].all?{|d|d>eps} c=(l+r)/2 la.map{|i|(i/c).to_i}.inject(:+)>=k ?(l=c):(r=c) end p (l+r)/2