結果
| 問題 |
No.1793 実数当てゲーム
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-12-22 01:07:03 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 233 ms / 2,000 ms |
| コード長 | 1,048 bytes |
| コンパイル時間 | 2,924 ms |
| コンパイル使用メモリ | 122,356 KB |
| 最終ジャッジ日時 | 2025-01-27 04:49:58 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
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;
}
Nachia