結果

問題 No.1793 実数当てゲーム
ユーザー maspymaspy
提出日時 2022-06-05 02:00:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 202,024 KB
実行使用メモリ 24,732 KB
平均クエリ数 2230.56
最終ジャッジ日時 2023-10-21 02:54:47
合計ジャッジ時間 5,420 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,732 KB
testcase_01 AC 27 ms
24,732 KB
testcase_02 AC 112 ms
24,732 KB
testcase_03 AC 113 ms
24,732 KB
testcase_04 AC 115 ms
24,732 KB
testcase_05 AC 103 ms
24,732 KB
testcase_06 AC 103 ms
24,732 KB
testcase_07 AC 106 ms
24,732 KB
testcase_08 AC 107 ms
24,732 KB
testcase_09 AC 106 ms
24,732 KB
testcase_10 AC 104 ms
24,732 KB
testcase_11 AC 105 ms
24,732 KB
testcase_12 AC 115 ms
24,732 KB
testcase_13 AC 127 ms
24,732 KB
testcase_14 AC 127 ms
24,732 KB
testcase_15 AC 111 ms
24,732 KB
testcase_16 AC 127 ms
24,732 KB
testcase_17 AC 112 ms
24,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "main.cpp"
#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 = 12.22e74;
  for (int i = 0; i < 24; ++i) {
    Re mi = sqrt(lo * hi);
    if (ask(mi)) {
      lo = mi;
    } else {
      hi = mi;
    }
  }
  ans(sqrt(lo * hi));
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);

  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    // input();
    solve();
  }
}
0