結果

問題 No.1793 実数当てゲーム
ユーザー とりゐとりゐ
提出日時 2021-11-17 16:28:02
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 670 bytes
コンパイル時間 933 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 98,040 KB
平均クエリ数 343.33
最終ジャッジ日時 2023-10-13 19:56:34
合計ジャッジ時間 5,017 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
86,980 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 285 ms
94,580 KB
testcase_06 AC 265 ms
94,100 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdout
'''
2^24=16777216=1.67*10^7 なので普通に二分探索をすると不十分
y が小さいなら絶対誤差が 10^-5 以下,大きいなら相対誤差が 10^-5 以下になるようにしてやるといい
最初に 167 で二分探索を行ってみる
'''
def solve():
  print('?',167)
  stdout.flush()
  s=input()
  if s=='Yes':
    l,r=167,1222*10**72
  else:
    l,r=0,167
  for i in range(23):
    mid=(l+r)/2
    mid_str=float(mid)
    print('?','{:.07f}'.format(mid))
    stdout.flush()
    s=input()
    if s=='Yes':
      l=mid
    else:
      r=mid
  print('!',(l+r)/2)
  stdout.flush()

t=int(input())
while t:
  solve()
  t-=1
0