問題一覧 > 通常問題

No.1232 2^x = x

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 233
作問者 : t33f / テスター : 37zigen
お気に入りにしたユーザー ProblemId : 3014 / 自分の提出
問題文最終更新日: 2019-07-28 18:10:13
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. Show the original
yukicoder contest 266 (順位表) の他の問題:

Problem Statement

You are given primes $p_1, \dots, p_N$. For each $i$, find one positive integer $x$ not exceeding $10^{18}$ that satisfies $2^x = x \pmod {p_i}$.

Input

$N$
$p_1$
$\dots$
$p_N$

$1 \le N \le 1000$
$2 \le p_i \le 10^9$
$p_i$ is prime

Output

On line $i$, output a positive integer $x$ not exceeding $10^{18}$ that satisfies $2^x = x \pmod {p_i}$.
If no such integer exists, output $-1$ instead.
If there are multiple solutions, you may output any of them.

Sample

Sample 1
Input
3
5
3
2
Output
3
4
2

We have $2^3 = 8 = 3 \pmod 5$, $2^4 = 16 = 4 \pmod 3$, and $2^2 = 4 = 2 \pmod 2$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。