| 比赛 | 板子大赛 | 评测结果 | AAAAAAAAAA |
|---|---|---|---|
| 题目名称 | 取余运算 | 最终得分 | 100 |
| 用户昵称 | AeeE5x | 运行时间 | 0.031 s |
| 代码语言 | C++ | 内存使用 | 3.47 MiB |
| 提交时间 | 2025-01-22 09:05:36 | ||
#include<iostream>
using namespace std;
long long a,n,p;
int main(){
freopen("dmod.in","r",stdin);
freopen("dmod.out","w",stdout);
scanf("%lld%lld%lld",&a,&n,&p);
long long ans=1;
while(n){
if(n&1) ans=(ans*a)%p;
a=(a*a)%p;
n>>=1;
}
printf("%lld",ans);
return 0;
}