問題一覧 > 通常問題

No.1793 Real Number Guessing Game

レベル : / AI推定難易度 : 1725 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / リアクティブ問題 (詳しくはこちら)
タグ : (AC するまで非表示) / 解いたユーザー数 30
作問者 : 👑 to-omer / テスター : とりゐ
お気に入りにしたユーザー ProblemId : 7272 / 自分の提出
問題文最終更新日: 2021-12-20 18:36:53
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
Advent Calendar Contest 2021 (順位表) の他の問題:

This problem is the December 22 problem of yukicoder Advent Calendar Contest 2021.

Problem Statement

This is an interactive problem.
In this problem, each input contains $T$ test cases.

A loves a certain real number $x$ between $0$ and $12.22\times 10^{74}$, inclusive.
Guess A's favorite real number $x$ by asking the following question.

  • Is the real number $y$ less than or equal to $x$?

However, A is busy and will answer at most $24$ questions.
But A is kind, and will accept your answer as correct if its absolute error or relative error is at most $10^{-5}$.

▶What are absolute error and relative error?
  • Absolute error: for a true value $x$, the absolute error of $y$ is defined as $\displaystyle|x-y|$.
  • Relative error: for a true value $x\ (\neq 0)$, the relative error of $y$ is defined as $\displaystyle\frac{|x-y|}{|x|}$.

Input and Output

First, the number of test cases $T$ is given.

$T$

$T$ is an integer satisfying $1\le T \le 100$.

Then, $T$ test cases follow.

Print each question to standard output in the following format.

? $y$

Here, $0\le y\le 12.22\times 10^{74}$ must be satisfied.

The response to a question is given from standard input in the following format.

$S$

Here, $S$ is one of the following strings.

  • Yes: the real number $y$ is less than or equal to $x$.
  • No: the real number $y$ is not less than or equal to $x$.
  • -1: the number of questions exceeded $24$, or you produced invalid output. In this case, terminate your program immediately.

When answering with the real number $x$, print it to standard output in the following format.

! $x$

Here, $0\le x\le 12.22\times 10^{74}$ must be satisfied.
Your answer is treated as correct if its absolute error or relative error is at most $10^{-5}$.

After that, continue with the next test case if there is one; otherwise, terminate your program immediately.

End each output with a newline and flush standard output.

Constraints

$1\le T\le 100$
$0\le x\le 12.22\times 10^{74}$

Sample

For $T=2$, the following interaction is possible.

InputOutputExplanation
2$T=2$
? 1Start of the first test case
No$1$ is not less than or equal to $x$
? 0.99999999
Yes$0.99999999$ is less than or equal to $x$
! 0.99999999
? 1.41421356Start of the second test case
Yes$1.41421356$ is less than or equal to $x$
! 3.14159265

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。