fork download
  1. n,x=gets.split(" ")
  2. n=n.to_i
  3. x=x.to_f
  4. ts=gets.split(" ").map{|e| e.to_f}
  5. ts.unshift(0.0)
  6. xs=gets.split(" ").map{|e| e.to_f}
  7. ans=10**10+0.0
  8. t=0.0
  9. (n+1).times{|i|
  10. t+=ts[i]
  11. t2=t+x/xs[i]
  12. ans=t2 if t2<ans
  13. }
  14. puts sprintf("%.5f", ans)
Success #stdin #stdout 0.01s 8036KB
stdin
5 10
1 2 3 4 5
1 2 3 4 5 6
stdout
6.00000