Sample Input
10 10
Sample Output
Case #1: 999999937
打表找规律 快速幂
#include<cstdio>
using namespace std;
#define ll long long
const int mod=1e9+7;
///注意取余
ll pow(ll a,ll n)
{
ll text=1;
while (n)
{
if (n&1) text = (text%mod)*(a%mod)%mod;
a = (a%mod)*(a%mod)%mod;
n >>= 1;
}
return text;
}
int main()
{
ll n,k;
int i=1;
while(~scanf("%lld%lld",&n,&k))
{
ll text=pow(n,k);
printf("Case #%d: %lld\n",i++,text);
}
return 0;
}