d012: 例題 P-2-3. 快速冪
Tags : Binary Exponentiation
Accepted rate : 264人/288人 ( 92% ) [非即時]
評分方式:
Tolerant

最近更新 : 2022-04-17 17:41

Content

輸入正整數 $x$, $y$ 與 $p$,計算 $x^y \bmod p$。$x$, $y$, $p$ 皆不超過 $10^9 + 9$。例如 $x=2,y=5, p=11$,則答案是$10$。

Input

輸入 $x$, $y$ 與 $p$ 在同一行,以空白間隔,行尾可能有空格。

Output

輸出計算結果。

Sample Input #1
2 5 11
Sample Output #1
10
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (5%): 0.6s , <1K
公開 測資點#1 (5%): 0.6s , <1K
公開 測資點#2 (5%): 0.6s , <1K
公開 測資點#3 (5%): 0.6s , <1K
公開 測資點#4 (5%): 0.6s , <1K
公開 測資點#5 (5%): 0.6s , <1K
公開 測資點#6 (5%): 0.6s , <1K
公開 測資點#7 (5%): 0.6s , <1K
公開 測資點#8 (5%): 0.6s , <1K
公開 測資點#9 (5%): 0.6s , <1K
公開 測資點#10 (5%): 0.6s , <1K
公開 測資點#11 (5%): 0.6s , <1K
公開 測資點#12 (5%): 0.6s , <1K
公開 測資點#13 (5%): 0.6s , <1K
公開 測資點#14 (5%): 0.6s , <1K
公開 測資點#15 (5%): 0.5s , <1K
公開 測資點#16 (5%): 0.5s , <1K
公開 測資點#17 (5%): 0.5s , <1K
公開 測資點#18 (5%): 0.5s , <1K
公開 測資點#19 (5%): 0.5s , <1K
Hint :
Tags:
Binary Exponentiation
出處:
AP325 [管理者:
TCIRC ($\mathbb{TCFSH}\ \mathtt{Comp.}\ \&\ \mathsf{Info.}\ \mathit{Club}$)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」