Untitled
unknown
c_cpp
2 years ago
832 B
6
Indexable
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0)
#define ll long long
using namespace std ;
ll mod = 1e9+7;
void dbg(){
cerr << endl;
}
template<typename H, typename... T> void dbg(H h, T... t){
cerr << h << ", ";
dbg(t...);
}
#define er(...) cerr << __LINE__ << " <" << #__VA_ARGS__ << ">: ", dbg(__VA_ARGS__)
ll pw(ll a , ll b , ll m){
if(b == 0) return 1;
a %= m;
ll res = 1 ;
while(b > 0){
if(b % 2 == 1) res = res * a % m;
a = a * a % m;
b /= 2;
}
return res;
}
int main(){
ll a , b , c;
ll n;
cin >> n;
for(int i = 0 ; i < n ; i++){
cin >> a >> b >> c;
ll d = pw(b , c , mod-1) ;
cout << pw(a , d , mod) << '\n';
}
return 0;
}Editor is loading...