3 2 3 4 3 3 5 4 4 6
0 2 4
#include<iostream> using namespace std; int main() { int a,b,c; int n; cin>>n; while(n--) { cin>>a>>b>>c;int sum=1; for(int i=1;i<=b;i++) { sum*=a; sum%=c; if(sum==0) break; } cout<<sum<<endl; } return 0; }
杭电 HDU ACM 1420 Prepared for New Acmer
原文地址:http://blog.csdn.net/lsgqjh/article/details/44895625