| 记录编号 | 190782 | 评测结果 | AAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 1130.取余运算 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.002 s | ||
| 提交时间 | 2015-10-04 15:42:24 | 内存使用 | 0.29 MiB | ||
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
freopen("dmod.in","r",stdin);
freopen("dmod.out","w",stdout);
unsigned long long b,p,k,r;
scanf("%llu%llu%llu",&b,&p,&k);
r=1;
while(p!=0)
{
if(p%2==1)
r=r%k*b%k;
b=b%k*b%k;
p=p/2;
}
r=r%k;
printf("%llu",r);
return 0;
}