QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 1024 MB Puntuación total: 100 Interactivo Hackeable ✓

#11103. Cyan born from Blue

Estadísticas

This is an interactive problem.

There is a cute little magician in a cyan outfit waiting for your command. There is a hidden integer $x$ ($1 \le x \le 10^9$). You want to find it by asking the magician whether a certain integer $y$ is greater than $x$.

You can use the format "? $y$" to make a query. When $y > x$, the magician will reply $1$; when $y \le x$, the magician will reply $0$.

Interaction

You can make at most $100$ queries. To make a query, print "? $y$" ($1 \le y \le 10^9$) on a single line, and then read the response from standard input.

To output your answer, print "! $x$" on a single line. The output of the answer does not count towards the $100$ query limit.

After that, your program should terminate.

After printing a query, do not forget to print a newline and flush the output. For example, use fflush(stdout) or cout.flush() in C++, System.out.flush() in Java, flush(output) in Pascal, or stdout.flush() in Python.

It is guaranteed that the number is fixed in advance.

Examples

Input 1

0
0
0
1

Output 1

? 1
? 2
? 3
? 4
! 3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.