Type: RemoteJudge 1000ms 128MiB

【模板】快速幂

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

给你三个整数 a,b,pa,b,p,求 ab mod pa^b \bmod p。

输入格式

输入只有一行三个整数,分别代表 a,b,pa,b,p。

输出格式

输出一行一个字符串 a^b mod p=s,其中 a,b,pa,b,p 分别为题目给定的值, ss 为运算结果。

2 10 9

2^10 mod 9=7

提示

样例解释

210=10242^{10} = 1024,1024 mod 9=71024 \bmod 9 = 7。

数据规模与约定

对于 100%100\% 的数据,保证 0≤a,b<2310\le a,b < 2^{31},a+b>0a+b>0,2≤p<2312 \leq p \lt 2^{31}。

CSP-J 练习题

Not Attended
Status
Done
Rule
IOI
Problem
10
Start at
2026-10-26 8:00
End at
2026-10-30 8:00
Duration
96 hour(s)
Host
Partic.
16