結果

問題 No.246 質問と回答
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2015-07-23 15:01:53
言語 Ruby
(3.3.0)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 280 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 11,280 KB
実行使用メモリ 31,400 KB
平均クエリ数 30.90
最終ジャッジ日時 2023-09-23 20:03:19
合計ジャッジ時間 5,748 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
31,260 KB
testcase_01 AC 126 ms
30,880 KB
testcase_02 AC 123 ms
30,780 KB
testcase_03 AC 128 ms
31,336 KB
testcase_04 AC 124 ms
31,276 KB
testcase_05 AC 126 ms
31,168 KB
testcase_06 AC 123 ms
31,364 KB
testcase_07 AC 125 ms
30,784 KB
testcase_08 AC 126 ms
31,400 KB
testcase_09 AC 128 ms
30,880 KB
testcase_10 AC 126 ms
30,984 KB
testcase_11 AC 125 ms
30,656 KB
testcase_12 AC 125 ms
31,328 KB
testcase_13 AC 124 ms
30,940 KB
testcase_14 AC 125 ms
31,180 KB
testcase_15 AC 125 ms
31,296 KB
testcase_16 AC 129 ms
31,396 KB
testcase_17 AC 125 ms
31,276 KB
testcase_18 AC 124 ms
30,716 KB
testcase_19 AC 125 ms
30,692 KB
testcase_20 AC 125 ms
30,700 KB
testcase_21 AC 126 ms
31,192 KB
testcase_22 AC 126 ms
30,924 KB
testcase_23 AC 127 ms
30,852 KB
testcase_24 AC 126 ms
31,140 KB
testcase_25 AC 125 ms
30,892 KB
testcase_26 AC 122 ms
30,908 KB
testcase_27 AC 125 ms
31,060 KB
testcase_28 AC 125 ms
30,816 KB
testcase_29 AC 122 ms
31,184 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# Here your code !
l = 1
h = 10 ** 9


100.times do |i|
    o = (l + h + 1).div(2)
    puts "? #{o}"
    $stdout.flush
    
    if gets.to_i == 0
        h = o - 1
    else
        l = o
    end
    if l == h
        break 
    end
end

puts "! #{Random.rand(l..h)}"
$stdout.flush
0