結果
問題 |
No.1793 実数当てゲーム
|
ユーザー |
![]() |
提出日時 | 2022-06-05 02:00:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 147 ms / 2,000 ms |
コード長 | 702 bytes |
コンパイル時間 | 1,927 ms |
コンパイル使用メモリ | 195,196 KB |
最終ジャッジ日時 | 2025-01-29 18:17:28 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#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(); } }