結果

問題 No.253 ロウソクの長さ
ユーザー finefine
提出日時 2016-04-05 01:08:44
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 308 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 11,296 KB
実行使用メモリ 31,420 KB
平均クエリ数 29.92
最終ジャッジ日時 2023-09-23 10:16:36
合計ジャッジ時間 6,564 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
30,980 KB
testcase_01 AC 103 ms
30,740 KB
testcase_02 AC 103 ms
30,696 KB
testcase_03 AC 110 ms
31,420 KB
testcase_04 WA -
testcase_05 AC 106 ms
31,140 KB
testcase_06 AC 103 ms
30,608 KB
testcase_07 AC 104 ms
30,804 KB
testcase_08 AC 104 ms
31,408 KB
testcase_09 WA -
testcase_10 AC 104 ms
30,900 KB
testcase_11 AC 106 ms
31,308 KB
testcase_12 AC 104 ms
30,900 KB
testcase_13 AC 104 ms
30,900 KB
testcase_14 WA -
testcase_15 AC 104 ms
30,708 KB
testcase_16 AC 109 ms
30,972 KB
testcase_17 AC 102 ms
31,316 KB
testcase_18 AC 102 ms
31,244 KB
testcase_19 WA -
testcase_20 AC 104 ms
31,064 KB
testcase_21 AC 102 ms
30,756 KB
testcase_22 WA -
testcase_23 AC 104 ms
31,404 KB
testcase_24 AC 102 ms
31,380 KB
testcase_25 AC 105 ms
31,320 KB
testcase_26 AC 102 ms
31,356 KB
testcase_27 AC 101 ms
30,700 KB
testcase_28 AC 103 ms
31,288 KB
testcase_29 AC 103 ms
30,920 KB
testcase_30 AC 104 ms
31,228 KB
testcase_31 AC 104 ms
30,676 KB
testcase_32 AC 104 ms
31,324 KB
testcase_33 AC 103 ms
30,948 KB
testcase_34 WA -
testcase_35 AC 106 ms
30,828 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

l = 0
r = 1000000001
c = 0
loop{
    y = (l + r) / 2
    puts "? #{y}"
    STDOUT.flush
    ans = gets.to_i
    if ans == 0
        puts "! #{y + c}"
        STDOUT.flush
        break
    elsif ans > 0
        l = y
    else
        r = y
    end
    r = [r - 1,0].max
    l = [l - 1,0].max
    c += 1
    }
0