No.3115 One Power One Kill
問題文最終更新日: 2025-04-18 00:28:49
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
CPCTF 2025 : PPC
(順位表)
の他の問題:
Problem Statement
This is a reactive problem.
The judge holds a hidden integer $X$ between $100$ and $10^5$, inclusive. By performing the following operation $1$ time, determine $X'$ after the operation.
- You declare integers $A,B$ between $100$ and $10^5$, inclusive, and tell them to the judge.
- Let $Y=A^B \mathrm{mod} (10^{9}+7)$.
- The judge tells you $K=\gcd(X,Y)$.
- $X'$ is set to $X^A \mathrm{mod} B$.
The judge is adaptive and may change the value of $X$ along the way, as long as it does not contradict its responses so far.
Constraints
- $100 \le X \le 10^5$
Input and Output
First, output $A,B$.
$A$ $B$
$K$ computed by the judge is given.
$K$
Output your guess of $X'$.
$X'$
An integer $\mathrm{ret}$ representing the result is given.
$\mathrm{ret}$
$\mathrm{ret}=1$ means that your guess is correct.
$\mathrm{ret}=0$ means that your guess is incorrect.
Notes
- The judge is adaptive. See the sample for a concrete example.
- Flush after every output.
- For example, you can use
std::cout<<std::endlin C++ orprint(flush=True)in Python3.
- For example, you can use
- If your output format is incorrect, the judge result may be undefined.
Sample
| Input | Output | Explanation |
|---|---|---|
| The judge sets $X=100$. You are not told this value. | ||
123 456 | You chose $A=123,B=456$. | |
| The judge computes $Y=123^{456} \pmod{10^9+7} = 565291922$. | ||
2 | The judge computes $K=\gcd(X,Y)=2$. | |
| The judge computes $X'=100^{123} \pmod{456} = 64$. You are not told this value. | ||
64 | You guessed $X'=64$. | |
| $X=106$ would also not contradict $A,B,K$. | ||
| The judge changes to $X=106$. It is changed to $X'=106^{123}\pmod{456}=400$. | ||
0 | Your guess of $X'$ is judged to be incorrect. |
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。