結果

問題 No.1793 実数当てゲーム
ユーザー maspy
提出日時 2022-06-05 01:51:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 1,650 ms
コンパイル使用メモリ 194,348 KB
最終ジャッジ日時 2025-01-29 18:15:49
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void solve() {
  using Re = double;
  auto ask = [&](Re y) -> bool {
    cout << "? " << y << endl;
    cout.flush();
    string S;
    cin >> S;
    return S == "Yes";
  };

  auto ans = [&](Re x) -> void {
    cout << "! " << x << endl;
    cout.flush();
  };

  Re lo = 1e-6, hi = 1.222e75;
  for (int i = 0; i < 24; ++i) {
    Re mi = sqrt(lo * hi);
    if (ask(mi)) {
      lo = mi;
    } else {
      hi = mi;
    }
  }
  ans(sqrt(lo * hi));
}

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(15);

  int T;
  cin >> T;
  for (int i = 0; i < T; ++i) { solve(); }

  return 0;
}
0