結果

問題 No.1793 実数当てゲーム
ユーザー maspymaspy
提出日時 2022-06-05 01:55:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 201,876 KB
実行使用メモリ 24,684 KB
平均クエリ数 2230.56
最終ジャッジ日時 2023-10-21 02:54:12
合計ジャッジ時間 4,770 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,684 KB
testcase_01 AC 23 ms
24,684 KB
testcase_02 AC 105 ms
24,684 KB
testcase_03 AC 101 ms
24,684 KB
testcase_04 AC 102 ms
24,684 KB
testcase_05 AC 92 ms
24,684 KB
testcase_06 AC 93 ms
24,684 KB
testcase_07 AC 93 ms
24,684 KB
testcase_08 AC 96 ms
24,684 KB
testcase_09 AC 96 ms
24,684 KB
testcase_10 AC 95 ms
24,684 KB
testcase_11 AC 94 ms
24,684 KB
testcase_12 AC 106 ms
24,684 KB
testcase_13 AC 114 ms
24,684 KB
testcase_14 AC 117 ms
24,684 KB
testcase_15 AC 100 ms
24,684 KB
testcase_16 AC 116 ms
24,684 KB
testcase_17 AC 105 ms
24,684 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(int argc, char *argv[]) {
  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