Logo
(追記) (追記ここまで)

21094번 - Discrete Logarithm is a Joke 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 256 MB20716211388.281%

문제

$M = 10^{18} + 31$ is a prime number. $g = 42$ is a primitive root modulo $M,ドル which means that $g^{1} \bmod M, g^{2} \bmod M, \ldots, g^{M-1} \bmod M$ are all distinct integers from $[1; M)$. Let's define a function $f(x)$ as the smallest positive integer $p$ such that $g^{p} = x \bmod M$. $f$ is a bijection from $[1; M)$ to $[1; M)$.

Let's then define a sequence of numbers as follows:

  • $a_{0} = 960,002円,411円,612円,632円,915円$ (you can copy this number from the sample);
  • $a_{i + 1} = f(a_{i})$.

Given $n,ドル find $a_{n}$.

입력

The only line of input contains one integer $n$ (0ドル \le n \le 10^{6}$).

출력

Print $a_{n}$.

제한

예제 입력 1

0

예제 출력 1

960002411612632915

예제 입력 2

1

예제 출력 2

836174947389522544

예제 입력 3

300300

예제 출력 3

263358264583736303

예제 입력 4

1000000

예제 출력 4

300

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2021 > Day 5: Almost Retired Dandelion Contest, ICPC Camp Contest 2 M번

Contest > Open Cup > 2020/2021 Season > Stage 11: Grand Prix of Nizhny Novgorod M번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /