結果

問題 No.253 ロウソクの長さ
ユーザー yaoshimaxyaoshimax
提出日時 2016-05-08 13:10:06
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 482 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 6,732 KB
実行使用メモリ 24,516 KB
平均クエリ数 5.06
最終ジャッジ日時 2023-09-23 10:34:55
合計ジャッジ時間 6,046 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 34 ms
23,412 KB
testcase_02 AC 34 ms
23,832 KB
testcase_03 AC 34 ms
23,640 KB
testcase_04 AC 33 ms
23,388 KB
testcase_05 AC 34 ms
23,376 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 35 ms
23,376 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 33 ms
23,832 KB
testcase_15 AC 34 ms
23,652 KB
testcase_16 AC 34 ms
23,400 KB
testcase_17 AC 35 ms
24,264 KB
testcase_18 RE -
testcase_19 AC 35 ms
23,412 KB
testcase_20 RE -
testcase_21 AC 35 ms
23,832 KB
testcase_22 AC 34 ms
24,012 KB
testcase_23 RE -
testcase_24 AC 33 ms
24,012 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 34 ms
23,364 KB
testcase_35 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

left=10
right=10000000000
print "? %d" % 512
sys.stdout.flush()
res=int(raw_input())
if res>0:
    left=513
elif res<0:
    right=511
else:
    print "! %d" % 512
    sys.stdout.flush()
    exit()

t=1
while left < right:
    mid=(left+right)/2
    print "? %d" % (mid-t)
    sys.stdout.flush()
    res=int(raw_input())
    if res>0:
        left=mid+1
    elif res<0:
        right=mid-1
    else:
        left=right=mid
    t+=1
print "! %d" % left
sys.stdout.flush()
0