結果

問題 No.1793 実数当てゲーム
ユーザー 👑 rin204rin204
提出日時 2023-02-03 14:45:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 335 ms / 2,000 ms
コード長 946 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 87,596 KB
実行使用メモリ 97,800 KB
平均クエリ数 2230.56
最終ジャッジ日時 2023-09-15 10:40:31
合計ジャッジ時間 7,315 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
94,260 KB
testcase_01 AC 178 ms
94,136 KB
testcase_02 AC 326 ms
97,164 KB
testcase_03 AC 323 ms
97,336 KB
testcase_04 AC 324 ms
97,312 KB
testcase_05 AC 314 ms
96,848 KB
testcase_06 AC 322 ms
97,800 KB
testcase_07 AC 321 ms
97,308 KB
testcase_08 AC 320 ms
97,512 KB
testcase_09 AC 315 ms
97,364 KB
testcase_10 AC 313 ms
96,948 KB
testcase_11 AC 316 ms
97,040 KB
testcase_12 AC 323 ms
97,076 KB
testcase_13 AC 321 ms
96,936 KB
testcase_14 AC 328 ms
96,980 KB
testcase_15 AC 322 ms
96,996 KB
testcase_16 AC 335 ms
97,464 KB
testcase_17 AC 326 ms
97,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from pprint import pprint

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