LeetCode:72. 超级次方
class Solution {
private:
int base=1337;
//求a的k次幂并与base求模
int mypow(int a,int k){
int res=1;
a%=base;
for(int i=0;i<k;i++){
res*=a;
res%=base;
}
return res;
}
public:
int superPow(int a, vector<int>& b) {
if(b.empty()) return 1;
int last=b.back();
b.pop_back();
int part1=mypow(a,last);
int part2=mypow(superPow(a,b),10);
return (part1*part2)%base;
}
};
