Solution
1712-Exponentiation_II.cpp
1#include<bits/stdc++.h>
2using namespace std;
3#define int long long
4constexpr int MOD=1e9+7;
5int binpow(int&a,int b,int m){
6 int ret=1;
7 while(b){
8 if(b&1)ret=ret*a%m;
9 a=a*a%m,b>>=1;
10 }
11 return ret;
12}
13signed main(){
14 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
15 int t; cin>>t;
16 while(t--){
17 int a,b,c; cin>>a>>b>>c;
18 cout<<binpow(a,binpow(b,c,MOD-1),MOD)<<'\n';
19 }
20 return 0;
21}Editorial not yet generated for this problem. Run the editorial generation script to add hints and detailed explanations.