No.2357 Guess the Function
問題文最終更新日: 2023-06-23 23:37:46
English (AI translation)
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
yukicoder contest 394
(順位表)
の他の問題:
Problem Statement
This is an interactive problem.
sounansya has integers $A,B$ satisfying $0\le A < B\le 100$. You may ask the following question up to $2$ times.Constraints
Input and Output
This is an interactive problem (a problem in which your program and the judge program interact through input and output).Repeat asking questions until you can determine the integers $A,B$.
Print each question to standard output in the following format.$?$ $x$The response to it is given from standard input in the following format.
$y$Here, $y$ is the remainder when $x+A$ is divided by $B$. Once you have determined the integers $A,B$, print them to standard output in the following format.
$!$ $A$ $B$
Notes
Sample
The following is an example of an interaction that starts with $A=1$, $B=2$.
| Input | Output | Explanation |
|---|---|---|
? 2 |
Ask for the remainder when $2+A$ is divided by $B$. | |
1 |
The remainder when $2+1$ is divided by $2$ is $1$, so $1$ is returned. | |
? 3 |
Ask for the remainder when $3+A$ is divided by $B$. | |
0 |
The remainder when $3+1$ is divided by $2$ is $0$, so $0$ is returned. | |
! 1 2 |
The answer is determined to be $A=1,B=2$, so print it. |
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。