結果
| 問題 | No.253 ロウソクの長さ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-10-02 19:21:35 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 41 ms / 2,000 ms | 
| コード長 | 484 bytes | 
| コンパイル時間 | 151 ms | 
| コンパイル使用メモリ | 6,912 KB | 
| 実行使用メモリ | 25,232 KB | 
| 平均クエリ数 | 21.11 | 
| 最終ジャッジ日時 | 2024-07-17 00:27:22 | 
| 合計ジャッジ時間 | 3,600 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 36 | 
ソースコード
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)
            
            
            
        