| 比赛 | 板子大赛 | 评测结果 | AAAAAAAAAA |
|---|---|---|---|
| 题目名称 | 取余运算 | 最终得分 | 100 |
| 用户昵称 | zqy | 运行时间 | 0.029 s |
| 代码语言 | C++ | 内存使用 | 3.27 MiB |
| 提交时间 | 2025-01-22 08:53:44 | ||
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
ll a,b,mod;
ll ksm(ll a,ll b){
ll ans=1;
while(b){
if(b&1)ans=(ans*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return ans;
}
int main(){
freopen("dmod.in","r",stdin);
freopen("dmod.out","w",stdout);
cin>>a>>b>>mod;
cout<<(ksm(a,b)+mod)%mod<<endl;
return 0;
}