Обработка математики: 100%
Sign in
or
Register
Courses
Textbook
Compiler
Contests
Topics
Courses
算術
高速累乗
Module:
高速累乗
Problem
3
/5
フェルマーの小定理の応用
Problem
数値
a
と素数
p
が与えられます。
(
a
∗
x
)
%
p
=
1
となるような最小数
x
を見つけます。
入力
入力は 2 つの自然数
a
,
p
(
a
,
p
<=
10
18
).
インプリント
問題の答えを出力してください。
例
<頭> <本体>
1000
ms
256 Mb
Rules for program design and list of errors in automatic problem checking
Teacher commentary
#
入力
出力
1
2 5
3