- C20250089's blog
A1616 A的B次方
- 2023-3-13 10:10:43 @
#include<bits/stdc++.h>
using namespace std;
long long f(long long a,long long n,long long c){
if(n==0) return 1;
long long ff=f(a,n/2,c);
if(n%2==0) return ff*ff%c;
return ff*ff%c*a%c;
}
int main(){
long long a,b,m;
cin>>a>>b>>m;
cout<<f(a,b,m);
return 0;
}