結果

問題 No.253 ロウソクの長さ
ユーザー finefine
提出日時 2016-04-05 01:22:48
言語 Ruby
(3.3.0)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 583 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 11,456 KB
実行使用メモリ 31,552 KB
平均クエリ数 34.25
最終ジャッジ日時 2023-09-23 23:43:17
合計ジャッジ時間 5,852 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
31,064 KB
testcase_01 AC 100 ms
30,896 KB
testcase_02 AC 103 ms
30,852 KB
testcase_03 AC 106 ms
30,808 KB
testcase_04 AC 101 ms
30,908 KB
testcase_05 AC 103 ms
31,488 KB
testcase_06 AC 104 ms
31,328 KB
testcase_07 AC 102 ms
30,904 KB
testcase_08 AC 101 ms
30,916 KB
testcase_09 AC 103 ms
30,892 KB
testcase_10 AC 103 ms
31,180 KB
testcase_11 AC 103 ms
30,828 KB
testcase_12 AC 101 ms
30,876 KB
testcase_13 AC 101 ms
31,352 KB
testcase_14 AC 102 ms
31,288 KB
testcase_15 AC 103 ms
31,040 KB
testcase_16 AC 102 ms
31,156 KB
testcase_17 AC 101 ms
30,976 KB
testcase_18 AC 103 ms
31,304 KB
testcase_19 AC 102 ms
31,012 KB
testcase_20 AC 105 ms
31,528 KB
testcase_21 AC 105 ms
31,552 KB
testcase_22 AC 104 ms
31,392 KB
testcase_23 AC 100 ms
30,996 KB
testcase_24 AC 105 ms
31,256 KB
testcase_25 AC 103 ms
31,092 KB
testcase_26 AC 100 ms
31,408 KB
testcase_27 AC 102 ms
31,408 KB
testcase_28 AC 101 ms
30,924 KB
testcase_29 AC 98 ms
31,152 KB
testcase_30 AC 101 ms
31,300 KB
testcase_31 AC 100 ms
31,204 KB
testcase_32 AC 98 ms
30,660 KB
testcase_33 AC 99 ms
31,396 KB
testcase_34 AC 98 ms
30,640 KB
testcase_35 AC 96 ms
30,936 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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