結果

問題 No.253 ロウソクの長さ
ユーザー yaoshimax
提出日時 2016-05-08 13:10:06
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 482 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 25,604 KB
平均クエリ数 5.06
最終ジャッジ日時 2024-07-16 10:06:16
合計ジャッジ時間 6,602 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 RE * 21
権限があれば一括ダウンロードができます

ソースコード

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