結果

問題 No.1793 実数当てゲーム
ユーザー 👑 rin204
提出日時 2024-07-07 15:44:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 279 ms / 2,000 ms
コード長 988 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 97,896 KB
平均クエリ数 2230.56
最終ジャッジ日時 2024-09-28 13:43:21
合計ジャッジ時間 6,602 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from pprint import pprint
import sys

sys.set_int_max_str_digits(10**6)

DEBUG = False

if DEBUG:
    x = ""
    n = 1.41421356237309504880168872420969807856967187537694

    def print(Q, flush):
        # pprint(Q)
        y = float(Q[2:])
        if Q[0] == "!":
            mi = min(abs(n - y), abs(n - y) / abs(n))
            pprint(mi)
            return
        global x
        if y <= n:
            x = "Yes"
        else:
            x = "No"

    def input():
        return x


def judge(Q):
    print(Q, flush=True)
    if Q[0] == "?":
        return input()


T = 1
if not DEBUG:
    T = int(input())

for _ in range(T):
    r = 12.22 * 10**74
    l = 10**-6
    for _ in range(24):
        mid = (l * r) ** 0.5
        res = judge(f"? {mid:.12f}")
        # pprint(res)
        if res == "No":
            r = mid
        elif res == "Yes":
            l = mid
        else:
            assert False
            exit()

    ans = (l * r) ** 0.5
    judge(f"! {ans:.12f}")
0