Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def calc()
- #input
- input = gets.split(' ').map {|s| s.to_i}
- raise "Wrong number of arguments" if input.length != 4
- r, t, vmouse, vcat, = input
- #calculate
- perim = 2 * Math::PI * r
- dist = [(t * vmouse), perim/2].min
- vcat-vmouse <= 0 ? result = -1 : result = dist / (vcat-vmouse)
- #output
- puts sprintf('%.9f', result)
- end
Advertisement
Add Comment
Please, Sign In to add comment