Description
Input
Output
Sample Input
Sample Output
1 #include<cstdio> 2 #include<string.h> 3 using namespace std; 4 int pow_mod(int a,int n,int m) 5 { 6 int ans=1; 7 for(int i=0;i<n;i++) ans=(int)((long long)ans*a%m);//记住这个公式! 8 return ans; 9 } 10 int main() 11 { 12 int p; 13 while(scanf("%d",&p)!=EOF) 14 { 15 int s,b,c; 16 while(p--) 17 { 18 scanf("%d%d%d",&s,&b,&c); 19 // printf("%d %d %d",a,b,c); 20 int temp; 21 temp=pow_mod(s,b,c); 22 printf("%d\n",temp); 23 } 24 } 25 return 0; 26 }
D - Prepared for New Acmer,布布扣,bubuko.com
原文:http://www.cnblogs.com/angledamon/p/3894144.html