結果

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

テストケース

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

ソースコード

diff #

#line 1 "main.cpp"
#include <bits/stdc++.h>

using namespace std;

void solve() {
  double lb = 1e-6, ub = 1.222e75;
  int i;
  string s;
  for (i = 0; i < 24; i++) {
    const double m = sqrt(lb * ub);
    cout << "? " << m << endl;
    cout.flush();
    cin >> s;
    if (s == "Yes") {
      lb = m;
    } else {
      ub = m;
    }
  }

  const double y = (lb + ub) / 2;
  cout << "! " << y << endl;
  cout.flush();
}

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