結果

問題 No.246 質問と回答
ユーザー Pump0129
提出日時 2018-04-30 03:37:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 734 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 27,736 KB
平均クエリ数 31.57
最終ジャッジ日時 2024-07-16 20:15:49
合計ジャッジ時間 4,210 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

if __name__ == "__main__":
    center_num = int(1000000000 / 2)
    num_range = int(1000000000 / 2)

    while not num_range == 1:
        print("? {}".format(center_num), flush=True)
        res = int(input()) == 1
        if res:
            center_num = center_num + int(num_range / 2)
        else:
            center_num = center_num - int(num_range / 2)
        num_range = int((num_range + 1) / 2)

    print("? {}".format(center_num), flush=True)
    res = int(input()) == 1
    if res:
        print("? {}".format(center_num + 1), flush=True)
        res = int(input()) == 1
        if res:
            center_num += 1
    else:
        center_num -= 1
    print("! {}".format(center_num), flush=True)
0