問題一覧 > 通常問題

No.1819 Mirrored 2

レベル : / AI推定難易度 : 2100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 46
作問者 : nok0 / テスター : hir355 riano
お気に入りにしたユーザー ProblemId : 7547 / 自分の提出
問題文最終更新日: 2022-01-10 22:23:29
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 328 (順位表) の他の問題:

Problem Statement

For a positive integer $n$, let $\mathrm{rev}(n)$ be the integer obtained by reversing the decimal representation of $n$ (without leading $0$s). For example, $\mathrm{rev}(1234) = 4321$ and $\mathrm{rev}(5000) = 5$.

You are given primes $P,Q$ and positive integers $x,y$. Here, $P = 90007$. Report one positive integer $N$ not exceeding $10^{100000}$ that satisfies both of the following conditions.

  • $N\bmod P=x$
  • $\mathrm{rev}(N)\bmod Q=y$

It can be proved that, under the constraints of this problem, an $N$ satisfying the conditions always exists.

Constraints

  • All inputs are integers.
  • $P = 90007$
  • $2\le Q < 10^{12}$
  • $1\le x < P$
  • $1\le y < Q$
  • $P,Q$ are primes.

Input

$P$ $Q$ $x$ $y$ 

Output

Output one positive integer $N$ not exceeding $10^{100000}$ that satisfies the conditions. Print a newline at the end.

Note that omitting the newline or printing extra leading $0$s will be treated as WA.

Sample

Sample 1
Input
90007 73 1 1
Output
90008

$90008 \bmod 90007 = 1$, and $\mathrm{rev}(90008)=80009,80009 \bmod 73=1$, so the conditions are satisfied.

Many other correct answers are possible. Output any one of them.

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