結果
問題 | No.1793 実数当てゲーム |
ユーザー |
![]() |
提出日時 | 2022-06-05 01:54:33 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 141 ms / 2,000 ms |
コード長 | 2,357 bytes |
コンパイル時間 | 1,169 ms |
コンパイル使用メモリ | 126,000 KB |
最終ジャッジ日時 | 2025-01-29 18:16:05 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <algorithm> #include <iostream> #include <cstdio> #include <map> #include <numeric> #include <cmath> #include <set> #include <sstream> #include <string> #include <vector> #include <queue> #include <stack> #include <complex> #include <string.h> #include <unordered_set> #include <unordered_map> #include <bitset> #include <iomanip> #include <sys/time.h> #include <tuple> #include <random> #include <stdio.h> #include <bitset> #include <cassert> using namespace std; #define endl '\n' #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() #define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end()) typedef long long ll; typedef long double ld; typedef pair<int, int> P; typedef tuple<int, int, vector<int>> T; typedef complex<double> comp; typedef vector< vector<ld> > matrix; struct pairhash { public: template<typename T, typename U> size_t operator()(const pair<T, U> &x) const { size_t seed = hash<T>()(x.first); return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2); } }; const int inf = 1e9 + 9; const ll mod = 1e9 + 7; const double eps = 1e-8; const double pi = acos(-1); double get_elapsed_time(struct timeval *begin, struct timeval *end) { return (end->tv_sec - begin->tv_sec) * 1000 + (end->tv_usec - begin->tv_usec) / 1000.0; } unsigned long xor128(void) { static unsigned long x=123456789,y=362436069,z=521288629,w=88675123; unsigned long t; t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) ); } // [0, k) int rand(int k) { return xor128() % k; } random_device seed_gen; ranlux24 engine(seed_gen()); double error(const double x, const double y) { return min(abs(x - y) / x, abs(x - y)); } 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(); } void input() { } 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(); } }