求快速幂

求快速幂

是什么?

给定A, B, P,求(A^B) mod P

可以使用python中自带的pow函数

A,B,P=map(int,input().split())
print(pow(A,B,P)) #pow(A,B,P)表示为求解(A^B) mod P

 

posted @ 2022-04-05 20:56  天空之城—我的理想国  阅读(19)  评论(0编辑  收藏  举报