menu ZJOJ
account_circle 请登录
home
首页
book
题目
apps
分类
play_circle_outline
状态
assessment
竞赛
assignment
作业
equalizer
排名
assignment_ind
登录
person_add
注册
1557: 快速幂
时间限制:1.000s
内存限制:128MB

题目描述

给你三个整数 lns="http://www.w3.org/1998/Math/MathML">a,b,p,求 lns="http://www.w3.org/1998/Math/MathML">a^b \bmod p

输入格式

输入只有一行三个整数,分别代表 lns="http://www.w3.org/1998/Math/MathML">a,b,p

输出格式

输出一行一个字符串 a^b mod p=s,其中 lns="http://www.w3.org/1998/Math/MathML">a,b,p 分别为题目给定的值, lns="http://www.w3.org/1998/Math/MathML">s 为运算结果。

样例输入 content_copy

2 10 9

样例输出 content_copy

2^10 mod 9=7

提示/说明

样例解释

lns="http://www.w3.org/1998/Math/MathML">2^{10} = 1024lns="http://www.w3.org/1998/Math/MathML">1024 \bmod 9 = 7

数据规模与约定

对于 lns="http://www.w3.org/1998/Math/MathML">100\% 的数据,保证 lns="http://www.w3.org/1998/Math/MathML">0\le a,b < 2^{31}lns="http://www.w3.org/1998/Math/MathML">a+b>0lns="http://www.w3.org/1998/Math/MathML">2 \leq p \lt 2^{31}