题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1420
3 2 3 4 3 3 5 4 4 6
0 2 4
代码如下:
#include <cstdio>
int main()
{
__int64 t;
__int64 a, b, c;
scanf("%I64d",&t);
while(t--)
{
scanf("%I64d%I64d%I64d",&a,&b,&c);
__int64 ans = 1;
for(int i = 0; i < b; i++)
{
ans *= a;
ans%=c;
}
printf("%I64d\n",ans);
}
return 0;
}HDU 1420 Prepared for New Acmer(数学题)
原文:http://blog.csdn.net/u012860063/article/details/39177037