結果
問題 | No.1793 実数当てゲーム |
ユーザー |
👑 ![]() |
提出日時 | 2024-09-16 14:46:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 207 ms / 2,000 ms |
コード長 | 1,067 bytes |
コンパイル時間 | 902 ms |
コンパイル使用メモリ | 94,444 KB |
最終ジャッジ日時 | 2025-02-24 08:56:24 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <cassert> #include <cstdint> using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) int main() { cout.precision(10); fixed(cout); int T; cin >> T; double maxval = 1.222e75; vector<double> table; for(double i=0.0; i<1.0; i+=1.99e-5) table.push_back(i); table.push_back(1.0); while(table.back() < maxval) table.push_back(table.back() * (1.0 + 1.99e-5)); table.back() = maxval; assert(log2(table.size()) < 23.06); while(T--){ int ok = 0; int ng = table.size() - 1; while(abs(ok - ng) > 1){ int mid = (ok + ng) / 2; cout << "? " << table[mid] << endl; string res; cin >> res; if(res == "-1") return 0; if(res == "Yes") ok = mid; else ng = mid; } double ans = (table[ok] + table[ng]) / 2; cout << "! " << ans << endl; } return 0; }