結果

問題 No.246 質問と回答
ユーザー tnodino
提出日時 2022-07-06 18:18:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 230 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,608 KB
平均クエリ数 30.90
最終ジャッジ日時 2024-07-16 20:29:59
合計ジャッジ時間 4,269 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

def question(y):
    print(f'? {y}')
    return int(input())

def answer(y):
    print(f'! {y}')

ok = 1
ng = 10**9+1
while ng - ok > 1:
    x = (ok + ng) // 2
    if question(x):
        ok = x
    else:
        ng = x
answer(ok)
0