結果

問題 No.246 質問と回答
ユーザー shi-moshi-mo
提出日時 2016-04-01 21:22:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 194 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 11,488 KB
実行使用メモリ 31,504 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:15:32
合計ジャッジ時間 5,602 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
31,216 KB
testcase_01 AC 121 ms
30,656 KB
testcase_02 AC 125 ms
30,836 KB
testcase_03 AC 123 ms
31,228 KB
testcase_04 AC 121 ms
31,292 KB
testcase_05 AC 120 ms
30,916 KB
testcase_06 AC 120 ms
31,168 KB
testcase_07 AC 118 ms
31,168 KB
testcase_08 AC 116 ms
31,272 KB
testcase_09 AC 119 ms
31,064 KB
testcase_10 AC 119 ms
30,940 KB
testcase_11 AC 119 ms
30,876 KB
testcase_12 AC 120 ms
30,576 KB
testcase_13 AC 121 ms
30,872 KB
testcase_14 AC 120 ms
30,968 KB
testcase_15 AC 118 ms
31,292 KB
testcase_16 AC 121 ms
31,376 KB
testcase_17 AC 123 ms
31,060 KB
testcase_18 AC 121 ms
30,676 KB
testcase_19 AC 122 ms
30,880 KB
testcase_20 AC 124 ms
31,156 KB
testcase_21 AC 121 ms
30,852 KB
testcase_22 AC 121 ms
30,824 KB
testcase_23 AC 123 ms
30,948 KB
testcase_24 AC 120 ms
30,852 KB
testcase_25 AC 119 ms
31,124 KB
testcase_26 AC 122 ms
31,308 KB
testcase_27 AC 121 ms
30,720 KB
testcase_28 AC 119 ms
31,504 KB
testcase_29 AC 121 ms
31,000 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

MAX = 10 ** 9
l, u = 1, MAX

while l != u
  c = (0.5 * (u + l)).ceil
  puts "? #{c}"
  STDOUT.flush

  if '1' == gets.chomp!
    l = c
    next
  end
  u = c - 1
end

puts "! #{u}"
STDOUT.flush
0