题解
2025-10-31 19:55:14
发布于:北京
0阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
long long a,b,p;
long long quick_p(int a,int b,int p){
if(b==1) return a;
long long t=quick_p(a,b/2,p);
if(b%2) return t*t%p*a%p;
return t*t%p;
}
int main(){
cin>>a>>b>>p;
cout<<a<<"^"<<b<<" mod "<<p<<"="<<quick_p(a,b,p);
return 0;
}
这里空空如也






有帮助,赞一个