Submission
Status:
[PPPPPPPPPPPPPPPPPPPP]
Score: 100
User: Ecir
Problemset: ยกกำลัง
Language: cpp
Time: 0.006 second
Submitted On: 2025-01-17 17:16:44
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
const int modd=1e9+7;
int expo(ll a,ll b){
ll ans=1;
while(b>1){
if(b%2==1){
ans*=a;
ans%=modd;
}
b/=2;
a=(a*a)%modd;
}
ans=(ans*a)%modd;
return ans%modd;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int n;cin >> n;
for(int i=1;i<=n;i++){
ll x,y;cin >> x >> y;
cout << expo(x,y) << "\n";
}
return 0;
}