Universal Cup Judging System

Universal Cup

Time Limit: 1 s Memory Limit: 2048 MB Total points: 100 Difficulty: [show] Interactive Hackable ✓
Statistics

這是一道互動題。

小青魚有一個秘密整數 $a$($1 \le a \le 100$)。你需要找出這個整數。

在一次詢問中,你選擇一個整數 $x$。小青魚會告訴你 $x$ 是否等於他的秘密整數。請在最多 $100$ 次詢問內找出這個秘密整數。

互動

若要發起一次詢問,請按以下格式輸出一行:「$?\ x$」,其中 $x$ 是一個整數($1 \le x \le 100$)。作為對該詢問的回應,你將得到單一單字 yes 或 no,分別表示 $x = a$ 或 $x \ne a$。你必須確保你發起的詢問次數不超過 $100$。

若要回報答案,請按以下格式輸出一行:「$!\ x$」,其中 $x$ 是秘密整數。回報答案不計入詢問次數。收到 yes 並不會結束互動:你仍然必須回報答案。你的程式必須在回報答案後立即終止。在輸出詢問或回報答案後,請不要忘記輸出換行字元並刷新輸出流。

在本題中,互動器不是自適應的。秘密整數在互動開始前就已經固定,且不會在互動過程中改變。

範例

輸入格式 1

no

no

yes

輸出格式 1

? 1

? 2

? 3

! 3

說明

在第一個範例中,秘密整數為 $3$。$x = 1$ 和 $x = 2$ 的詢問收到 no,而 $x = 3$ 的詢問收到 yes。隨後解答回報 ! 3。

在第二個範例中,秘密整數為 $1$。第一次詢問收到 yes,隨後解答回報 ! 1。

測試工具: 本題提供了一個測試工具,以幫助參賽者開發和測試自己的解答。你可以從附件中下載該工具。使用 -h 選項執行該工具可以查看其使用方式說明。該工具會檢查互動過程與所回報的答案,但不會強制執行時間或記憶體限制。

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.