QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 256 MB 總分: 100 互動

#15527. 隐藏的数字

统计

有一个长度为 $N$ ($1 \le N \le 18$) 的隐藏数字字符串(由数字 0 到 9 组成)。你想知道在这个隐藏的数字中,是否存在任意长度的子串,其代表的数值能被 3 整除。

你最多可以进行 2 次如下格式的询问:? i,它会告诉你所请求的下标 $i$ ($1 \le i \le N$) 处的数字。

输入格式

第一行包含一个整数 $N$,表示隐藏字符串的长度。

交互

你最多可以进行 2 次如下格式的询问:? i

在进行一次询问后,你将收到单行一个 0 到 9 的数字,表示隐藏字符串中下标 $i$ 处的数字。

给出答案时,如果存在能被 3 整除的子串,请输出单行 ! 1;否则输出 ! 0

样例

输入 1

2
6
8

输出 1

? 1
? 2
! 1

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.