left = 1 right = 1000000000 target = (left + right ) / 2 puts "?#{target}" while right - left >=1 STDOUT.flush respons = gets.to_i if respons == 1 then left = target target = (left + right) / 2 else right = target target = (left + right) / 2 end puts "? #{target}" end puts "! #{target}"