結果

問題 No.253 ロウソクの長さ
ユーザー nebukuro09nebukuro09
提出日時 2016-10-02 19:21:35
言語 Python2
(2.7.18)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 6,696 KB
実行使用メモリ 24,300 KB
平均クエリ数 21.11
最終ジャッジ日時 2023-09-24 00:34:37
合計ジャッジ時間 2,943 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,976 KB
testcase_01 AC 28 ms
23,328 KB
testcase_02 AC 27 ms
24,012 KB
testcase_03 AC 30 ms
23,748 KB
testcase_04 AC 28 ms
23,400 KB
testcase_05 AC 30 ms
23,292 KB
testcase_06 AC 28 ms
23,988 KB
testcase_07 AC 29 ms
23,532 KB
testcase_08 AC 28 ms
23,304 KB
testcase_09 AC 30 ms
23,916 KB
testcase_10 AC 30 ms
24,252 KB
testcase_11 AC 29 ms
23,532 KB
testcase_12 AC 32 ms
23,568 KB
testcase_13 AC 28 ms
23,892 KB
testcase_14 AC 27 ms
23,748 KB
testcase_15 AC 30 ms
23,388 KB
testcase_16 AC 29 ms
24,228 KB
testcase_17 AC 28 ms
23,400 KB
testcase_18 AC 31 ms
23,388 KB
testcase_19 AC 31 ms
23,976 KB
testcase_20 AC 30 ms
23,316 KB
testcase_21 AC 29 ms
23,316 KB
testcase_22 AC 28 ms
23,616 KB
testcase_23 AC 28 ms
23,616 KB
testcase_24 AC 29 ms
23,964 KB
testcase_25 AC 32 ms
23,304 KB
testcase_26 AC 29 ms
24,276 KB
testcase_27 AC 28 ms
24,300 KB
testcase_28 AC 31 ms
23,352 KB
testcase_29 AC 28 ms
23,628 KB
testcase_30 AC 30 ms
24,240 KB
testcase_31 AC 28 ms
24,012 KB
testcase_32 AC 29 ms
23,964 KB
testcase_33 AC 29 ms
23,628 KB
testcase_34 AC 30 ms
23,400 KB
testcase_35 AC 28 ms
23,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def ask(n):
    print '?', n
    sys.stdout.flush()
    return int(raw_input())

def ans(n):
    print '!', n
    sys.stdout.flush()
    exit()

res = ask(100)
if res == 0:
    ans(100)
high = 100 if res < 0 else 10**9
low = 0
i = 1

while high - low > 1:
    mid = (high+low)/2
    res = ask(mid-i)
    if res == 0:
        ans(mid)
    if res > 0:
        low = mid
    else:
        high = mid
    i += 1

res = ask(low-i)
if res == 0:
    ans(low)
else:
    ans(high)
0