結果

問題 No.246 質問と回答
ユーザー simansiman
提出日時 2020-11-27 18:54:21
言語 Ruby
(3.3.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 198 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,300 KB
実行使用メモリ 31,396 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:36:58
合計ジャッジ時間 5,553 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
31,352 KB
testcase_01 AC 114 ms
30,892 KB
testcase_02 AC 117 ms
31,076 KB
testcase_03 AC 121 ms
30,924 KB
testcase_04 AC 119 ms
31,048 KB
testcase_05 AC 118 ms
31,336 KB
testcase_06 AC 117 ms
30,852 KB
testcase_07 AC 119 ms
30,996 KB
testcase_08 AC 116 ms
31,048 KB
testcase_09 AC 115 ms
30,792 KB
testcase_10 AC 122 ms
30,980 KB
testcase_11 AC 124 ms
30,872 KB
testcase_12 AC 124 ms
30,952 KB
testcase_13 AC 124 ms
30,940 KB
testcase_14 AC 123 ms
30,960 KB
testcase_15 AC 122 ms
30,804 KB
testcase_16 AC 122 ms
31,112 KB
testcase_17 AC 122 ms
31,260 KB
testcase_18 AC 122 ms
31,044 KB
testcase_19 AC 125 ms
30,828 KB
testcase_20 AC 123 ms
30,976 KB
testcase_21 AC 121 ms
31,252 KB
testcase_22 AC 119 ms
31,396 KB
testcase_23 AC 116 ms
30,964 KB
testcase_24 AC 115 ms
31,332 KB
testcase_25 AC 120 ms
31,012 KB
testcase_26 AC 115 ms
31,340 KB
testcase_27 AC 116 ms
30,972 KB
testcase_28 AC 118 ms
31,100 KB
testcase_29 AC 118 ms
31,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

ok = 1
ng = 10 ** 9 + 1

while (ok - ng).abs >= 2
  x = (ok + ng) / 2

  STDOUT.puts("? #{x}")
  STDOUT.flush

  res = gets.to_i
  if res == 1
    ok = x
  else
    ng = x
  end
end

puts "! #{ok}"
0