Untitled
unknown
c_cpp
2 years ago
789 B
3
Indexable
#include <bits/stdc++.h> #define ios ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) #define ll long long int 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; ll res = pw(a , b/2 , m); res = res * res % m ; if(b % 2 == 1) res = res * a % m; return res; } int main(){ ll a , b , c; int 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); } return 0; }
Editor is loading...