|
|
back to boardWhat can be wrong here? Posted by Igor 17 Aug 2014 20:44 Submitted following solution, but WA on 1st test. I tried very different inputs and works fine actually. def get_input_number gets.chomp.to_f end def calculate_conductors(low_percent, high_percent) (2..10000).each do |citizens| konduktors = (low_percent*citizens).ceil if (low_percent*citizens < konduktors) && (konduktors < high_percent*citizens) return citizens end end end def prepare_input_and_go lower_border = get_input_number/100 upper_border = get_input_number/100 puts calculate_conductors(lower_border, upper_border) end prepare_input_and_go |
|
|