問題一覧 > 通常問題

No.2357 Guess the Function

レベル : / AI推定難易度 : 1050 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / リアクティブ問題 (詳しくはこちら)
タグ : (AC するまで非表示) / 解いたユーザー数 111
作問者 : 👑 qand / テスター : 👑 p-adic ygussany
お気に入りにしたユーザー ProblemId : 9529 / 自分の提出
問題文最終更新日: 2023-06-23 23:37:46
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.

  • Choose an integer $x$ between $1$ and $100$, inclusive. Then, ask for the remainder when $x+A$ is divided by $B$.
  • Guess the integers $A,B$ that sounansya has.

    Constraints

  • $0\le A < B\le 100$
  • The values of $A,B$ are fixed for each test case. That is, the values of $A,B$ do not change in response to the queries.
  • 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

  • Each time you print something, end it with a newline and flush standard output. Otherwise, the judge result may be TLE or WA.
  • If you print invalid output, the judge result is undefined. Note that printing extra spaces or newlines also counts as invalid output.
  • Terminate your program immediately after answering the integers $A,B$. Otherwise, the judge result is undefined.
  • The query for answering is not counted toward the number of questions.
  • 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もしくは右上の雲マークをクリックしてアカウントを作成してください。