题目:https://vjudge.net/contest/436484#problem/F
快速幂板子直接上
#include<stdio.h> const int N=1e9+7; long long kuaisu(long long x,long long y) { long long z=1; while(y) { if(y%2==1) z=z*x%N; x=(x*x)%N; y=y/2; } return z; } int main() { int t; scanf("%d",&t); while(t--) { long long n,m; scanf("%lld%lld",&n,&m); printf("%lld\n",kuaisu(n,m)); } return 0; }