QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Interactive Hackable ✓

#8484. 并非一切都如此模棱两可

Statistics

这是一个交互式问题。

评测程序选择了一个介于 $1$ 和 $10^9$ 之间的整数 $x$,以及一个进制 $b$ ($2 \le b \le 2023$),随后告诉你 $x$ 在 $b$ 进制表示下的位数。

你可以进行询问:“$x + d$ 有多少位”,其中 $d$ 是一个 $1$ 到 $10^{18}$ 之间的整数。你的任务是在不超过 $100$ 次询问内猜出 $x$ 和 $b$。

交互

交互开始时,评测程序会输出 $n$ —— 即 $x$ 在 $b$ 进制表示下的位数。

之后,你的程序可以进行形如 “? d” 的询问,其中 $1 \le d \le 10^{18}$,评测程序会输出答案 —— 即 $x + d$ 在 $b$ 进制表示下的位数。

如果你准备好输出答案,请打印 “! x b”,其中 $x$ 和 $b$ 是你猜出的数值和进制。输出答案不计入询问次数。

样例

输入格式 1

1
2
3

输出格式 1

? 1
? 3
! 1 2

说明

在交互示例中,询问和回复之间用空行隔开,以直观地展示交互过程。在与评测程序的实际交互中,不会有空行;也不应打印空行,但在每次询问后,以及输出答案后,必须打印换行符。

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.