【2017 Multi-University Training Contest - Team 3】RXD and math
发现
猜测答案是
写个快速幂;
注意对底数先取模;
1
看到过的人那么多就应该想到找规律的.
大胆猜测
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;
int n,k;
int get_ans(int x,int y){
int a = 1;
x%=MOD;
while (y){
if (y&1) a = (a*x)%MOD;
x=(x*x)%MOD;
y>>=1;
}
return a;
}
main(){
int kk = 0;
while (~scanf("%lld%lld",&n,&k)){
printf("Case #%lld: %lld\n",++kk,get_ans(n,k));
}
return 0;
}