結果

問題 No.1793 実数当てゲーム
ユーザー 沙耶花
提出日時 2021-12-22 00:13:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 887 bytes
コンパイル時間 4,524 ms
コンパイル使用メモリ 253,148 KB
最終ジャッジ日時 2025-01-27 04:31:22
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Inf 1000000000000000000

bool query(double x){
	cout<<"? "<<fixed<<setprecision(100)<<x<<endl;
	string ans;
	cin>>ans;
	if(ans[0]=='Y')return true;
	else return false;
}
void answer(double x){
	cout<<"! "<<fixed<<setprecision(100)<<x<<endl;
}
void solve(){
	double ok = 0.0,ng = 1.0;
	bool f = query(1.0);
	if(!f){
		double ok = 0.0,ng = 1.0;
		rep(_,22){
			double m = (ok+ng)/2.0;
			if(query(m))ok = m;
			else ng = m;			
		}
		answer(ok);
	}
	else{
		double ok = 1.0,ng = 12.22 * pow(10.0,74);
		rep(_,22){
			double m = sqrt(ok)*sqrt(ng);//sqrt(ok*ng);
			if(query(m))ok = m;
			else ng = m;			
		}
		answer(ok);
	}
}
int main(){
	
	int _t;
	cin>>_t;
	rep(_,_t){
		solve();
	}
	
	return 0;
}
0